Skip to content

Commit 96e4d92

Browse files
Merge branch '6.2' into 6.3
* 6.2: [Serializer] Handle datetime deserialization in U format [HttpFoundation] Fix file streaming after connection aborted Update HeaderBag::all PhpDoc [Messenger] Add `IS_REPEATABLE` flag to `AsMessageHandler` attribute Allow resources in Query::setParam Fix param type annotation [HttpClient] Fix setting duplicate-name headers when redirecting with AmpHttpClient
2 parents 3640094 + 1a34afe commit 96e4d92

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Middleware/Debug/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function stop(): void
4343
}
4444
}
4545

46-
public function setParam(string|int $param, null|string|int|float|bool &$variable, int $type): void
46+
public function setParam(string|int $param, mixed &$variable, int $type): void
4747
{
4848
// Numeric indexes start at 0 in profiler
4949
$idx = \is_int($param) ? $param - 1 : $param;

Tests/Middleware/Debug/MiddlewareTest.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,31 @@ public function testWithParamBound(callable $executeMethod)
145145
{
146146
$this->init();
147147

148-
$product = 'product1';
149-
$price = 12.5;
150-
$stock = 5;
148+
$sql = <<<EOT
149+
INSERT INTO products(name, price, stock, picture, tags)
150+
VALUES (?, ?, ?, ?, ?)
151+
EOT;
152+
153+
$expectedRes = $res = $this->getResourceFromString('mydata');
151154

152-
$stmt = $this->conn->prepare('INSERT INTO products(name, price, stock) VALUES (?, ?, ?)');
155+
$stmt = $this->conn->prepare($sql);
153156
$stmt->bindParam(1, $product);
154157
$stmt->bindParam(2, $price);
155158
$stmt->bindParam(3, $stock, ParameterType::INTEGER);
159+
$stmt->bindParam(4, $res, ParameterType::BINARY);
160+
161+
$product = 'product1';
162+
$price = 12.5;
163+
$stock = 5;
156164

157165
$executeMethod($stmt);
158166

159167
// Debug data should not be affected by these changes
160168
$debug = $this->debugDataHolder->getData()['default'] ?? [];
161169
$this->assertCount(2, $debug);
162-
$this->assertSame('INSERT INTO products(name, price, stock) VALUES (?, ?, ?)', $debug[1]['sql']);
163-
$this->assertSame(['product1', '12.5', 5], $debug[1]['params']);
164-
$this->assertSame([ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER], $debug[1]['types']);
170+
$this->assertSame($sql, $debug[1]['sql']);
171+
$this->assertSame(['product1', 12.5, 5, $expectedRes], $debug[1]['params']);
172+
$this->assertSame([ParameterType::STRING, ParameterType::STRING, ParameterType::INTEGER, ParameterType::BINARY], $debug[1]['types']);
165173
$this->assertGreaterThan(0, $debug[1]['executionMS']);
166174
}
167175

0 commit comments

Comments
 (0)