|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34022 prepared statement using blobs doesnt function
Submitted: 2005-08-07 00:54 UTC Modified: 2005-08-07 19:28 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mike dot norton at ultisearch dot co dot uk Assigned:
Status: Closed Package: MySQLi related
PHP Version: 5.0.4 OS: Fedora Core 3
Private report: No CVE-ID: None
 [2005-08-07 00:54 UTC] mike dot norton at ultisearch dot co dot uk
When using mysql with bind_params on blob data only the first 4 bytes of data get included.

Reproduce code:
  $mysqli = new mysqli("localhost", "user", "pass", "db");
 /* check connection */
 if (mysqli_connect_errno()) {
  printf("Connect failed: %s\n", mysqli_connect_error());
 $filename = "/path_to/files/5_copy14.jpg";
 /* create a prepared statement */
 $stmt =  $mysqli->stmt_init();
 $stmt->prepare("insert into user_image (image) values (?)");
 $data = fread(fopen($filename, "rb"), filesize($filename));
 $stmt->bind_param('b',$data);       /* Prove that the $data variable contains the correct data */
 print $data;

Expected result:
Image is displayed and image data is inserted into database 

Actual result:
First 4K of image is inserted into database rest seems to be discarded


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-07 19:28 UTC] mike dot norton at ultisearch dot co dot uk
Seems to work with that function correctly
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 02 07:03:34 2021 UTC