diff --git a/src/Symfony/Bridge/Doctrine/Middleware/Debug/Query.php b/src/Symfony/Bridge/Doctrine/Middleware/Debug/Query.php index dc8c9d79ae1fb..9813d712132f4 100644 --- a/src/Symfony/Bridge/Doctrine/Middleware/Debug/Query.php +++ b/src/Symfony/Bridge/Doctrine/Middleware/Debug/Query.php @@ -52,7 +52,7 @@ public function setParam(string|int $param, null|string|int|float|bool &$variabl $this->types[$idx] = $type; } - public function setValue(string|int $param, null|string|int|float|bool $value, int $type): void + public function setValue(string|int $param, mixed $value, int $type): void { // Numeric indexes start at 0 in profiler $idx = \is_int($param) ? $param - 1 : $param; diff --git a/src/Symfony/Bridge/Doctrine/Tests/Middleware/Debug/MiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Middleware/Debug/MiddlewareTest.php index 3a461a63749b5..05bea5a66cff6 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Middleware/Debug/MiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Middleware/Debug/MiddlewareTest.php @@ -17,6 +17,7 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Statement; +use Doctrine\DBAL\Types\Types; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Doctrine\Middleware\Debug\DebugDataHolder; use Symfony\Bridge\Doctrine\Middleware\Debug\Middleware; @@ -61,11 +62,22 @@ private function init(bool $withStopwatch = true): void id INTEGER PRIMARY KEY, name TEXT NOT NULL, price REAL NOT NULL, - stock INTEGER NOT NULL + stock INTEGER NOT NULL, + picture BLOB NULL, + tags TEXT NULL, + created_at TEXT NULL ); EOT); } + private function getResourceFromString(string $str) + { + $res = fopen('php://temp', 'r+'); + fwrite($res, $str); + + return $res; + } + public function provideExecuteMethod(): array { return [ @@ -102,18 +114,26 @@ public function testWithValueBound(callable $executeMethod) { $this->init(); - $stmt = $this->conn->prepare('INSERT INTO products(name, price, stock) VALUES (?, ?, ?)'); + $sql = <<conn->prepare($sql); $stmt->bindValue(1, 'product1'); $stmt->bindValue(2, 12.5); $stmt->bindValue(3, 5, ParameterType::INTEGER); + $stmt->bindValue(4, $res = $this->getResourceFromString('mybinarydata'), ParameterType::BINARY); + $stmt->bindValue(5, ['foo', 'bar'], Types::SIMPLE_ARRAY); + $stmt->bindValue(6, new \DateTime('2022-06-12 11:00:00'), Types::DATETIME_MUTABLE); $executeMethod($stmt); $debug = $this->debugDataHolder->getData()['default'] ?? []; $this->assertCount(2, $debug); - $this->assertSame('INSERT INTO products(name, price, stock) VALUES (?, ?, ?)', $debug[1]['sql']); - $this->assertSame(['product1', 12.5, 5], $debug[1]['params']); - $this->assertSame([ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER], $debug[1]['types']); + $this->assertSame($sql, $debug[1]['sql']); + $this->assertSame(['product1', 12.5, 5, $res, 'foo,bar', '2022-06-12 11:00:00'], $debug[1]['params']); + $this->assertSame([ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER, ParameterType::BINARY, ParameterType::STRING, ParameterType::STRING], $debug[1]['types']); $this->assertGreaterThan(0, $debug[1]['executionMS']); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy