|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-04-01 21:20 UTC] tpunt@php.net
-Status: Open
+Status: Wont fix
-Package: PDO_DBLIB
+Package: *General Issues
[2017-04-01 21:20 UTC] tpunt@php.net
[2017-04-01 21:22 UTC] tpunt@php.net
-Status: Wont fix
+Status: Re-Opened
-Package: *General Issues
+Package: PDO DBlib
[2017-04-01 21:22 UTC] tpunt@php.net
[2017-04-03 15:41 UTC] adambaratz@php.net
-Status: Re-Opened
+Status: Duplicate
[2017-04-03 15:41 UTC] adambaratz@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 31 23:00:01 2025 UTC |
Description: ------------ BLOB inserts are broken. A syntax error will get thrown because of improper encoding of the binary stream. Reproduce code: --------------- COVER_IMAGE = VARBINARY(max) EXCERPT = VARCHAR(max) ID = INT $blob_path = TESTS_BASE_DIR . '/etc/lob/propel.gif'; $clob_path = TESTS_BASE_DIR . '/etc/lob/tin_drum.txt'; $sql = "INSERT INTO media (COVER_IMAGE,EXCERPT,BOOK_ID) VALUES (:p1,:p2,:p3)"; $stmt = $this->con->prepare($sql); $fileStream = fopen($blob_path, 'r'); $stmt->bindParam(':p1', $fileStream, PDO::PARAM_LOB); $stmt->bindValue(':p2', file_get_contents($clob_path), PDO::PARAM_STR); $stmt->bindValue(':p3', 5, PDO::PARAM_INT); $stmt->execute(); fclose($fileStream); Actual result: -------------- PDOException: SQLSTATE[HY000]: General error: 10007 Incorrect syntax near 'GIF89a?'. [10007] (severity 5) [(null)]