php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45840 When you try to echo the contents of a BLOB it gives you a reference variable
Submitted: 2008-08-17 12:31 UTC Modified: 2008-08-17 14:16 UTC
From: trendboy at gmail dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 5.2.6 OS: Linux and Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: trendboy at gmail dot com
New email:
PHP Version: OS:

 

 [2008-08-17 12:31 UTC] trendboy at gmail dot com
Description:
------------
Steps to reproduce:

1) Create a page to read in a JPEG image from a URL location and inserts into the database to a BLOB.
2) On another page select * from your blob
3) Using any method, myself_fetch_array or assoc get the contents
4) Print or echo it out

You get Resource ID #5

Dump the vars from the result record set and you get
resource 3 type(mysql result)

It's very strange! It should be displaying the content of the blob to the screen and with the correct mime header set to jpeg it should show you the image.

I thought maybe it was a bug on the LINUX version so I installed the windows version and same issue.

Linux version:
/usr/local/php/bin/php --version
PHP 5.2.4 (cli) (built: Sep 17 2007 22:46:56)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

mysql --version
mysql  Ver 14.12 Distrib 5.0.27, for pc-linux-gnu (i686) using readline 5.0

I tried 5.2.6 on windows.

It's a right head-wrecker :) Is it a bug?

Reproduce code:
---------------
The code (shortened of course)

my insert is (after I get it from a URL etc): 
mysql_query("insert into thumbnail (image) values ('" . addslashes($img) . "')");

then to read it:

$sql = "select * from thumbnail where id = 1";
$result = mysql_query($sql);
 var_dump($result);
while ($row = mysql_fetch_assoc($result)){

echo $row[image];
}


Expected result:
----------------
You should see your image


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-17 14:16 UTC] trendboy at gmail dot com
I think I may have fixed it, it seems to be the upload I had was the problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 17:01:30 2024 UTC