|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-10 14:09 UTC] burleybutler at hotmail dot com
[2011-01-01 23:12 UTC] jani@php.net
-Package: Feature/Change Request
+Package: PostgreSQL related
[2011-01-26 15:11 UTC] wmoran at potentialtech dot com
[2012-03-31 05:30 UTC] yohgaki@php.net
[2012-03-31 05:30 UTC] yohgaki@php.net
-Assigned To:
+Assigned To: yohgaki
[2012-04-17 10:45 UTC] yohgaki@php.net
[2012-04-17 10:45 UTC] yohgaki@php.net
-Status: Assigned
+Status: Wont fix
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 23:00:01 2025 UTC |
Description: ------------ pg_query_params() stops processing binary 'bytea' field data at hex '00'. Reproduce code: --------------- <?php /** create a PostgreSQL database (I used 8.1) with a table that has a 'bytea' field. Use pg_query_params to insert binary data from a JPG image into the bytea field, something like: */ pg_query_params("INSERT INTO tabel (byteafield) values ($1)", file_get_contents('file.jpg')); ?> Expected result: ---------------- The image should be stored in the database completely. Actual result: -------------- Only the first four bytes of the JPG data make it into the database. JPG data starts with: hex FF D8 FF E0 00 10 4A 46 49 Apparently pg_query_params stops processing the content at '00' which I guess is because PHP thinks it is at 'EOF'. If you insert the data with a normal pg_query call and using pg_escape_bytea() on the JPG data then everything works just fine and the image is stored properly.