You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original text:
>If the user is specifying a PDO::PARAM_LOB, there's a good chance
>that it's a binary file (i.e. an image), that is too fragile to
>survive in a string, as escaping it is insufficient. Because
>PDO_DBLIB relies on PDO to fill in a parameterized query and
>submits the filled string to the server, it ends up mangling the
>query.
>
>This adds logic in the PDO_DBLIB quoter to handle binary parameters
>by using the SQL Server binary literal syntax (a hex string that
>begins with `0x`). This resolves the issue because PDO consults the
>quoter for filling in the query string.
// PARAM_LOB gets converted to a binary literal instead of a string literal
25
+
$stmt->bindParam(1, $binary, PDO::PARAM_BINARY);
26
+
$result = $stmt->execute();
27
+
28
+
// Verify we sent the binary literal over the wire
29
+
var_dump($stmt->debugDumpParams());
30
+
31
+
// Verify that we get the same PNG back over the wire
32
+
$rows = $stmt->fetchAll();
33
+
var_dump(base64_encode($rows[0][0]));
34
+
35
+
?>
36
+
--EXPECT--
37
+
SQL: [8] SELECT ?
38
+
Sent SQL: [149] SELECT 0x89504E470D0A1A0A0000000D49484452000000010000000108060000001F15C4890000000D49444154085B63606060F80F0001040100C12D8E500000000049454E44AE426082
0 commit comments