php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44693 read blob; ibase_blob_echo: BLOB not found
Submitted: 2008-04-11 09:38 UTC Modified: 2014-02-11 04:05 UTC
Votes:23
Avg. Score:2.0 ± 1.5
Reproduced:10 of 14 (71.4%)
Same Version:10 (100.0%)
Same OS:10 (100.0%)
From: david at zegrange dot com Assigned:
Status: No Feedback Package: InterBase related
PHP Version: 5.2.5 OS: Mandriva 2008.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: david at zegrange dot com
New email:
PHP Version: OS:

 

 [2008-04-11 09:38 UTC] david at zegrange dot com
Description:
------------
Hello. We were using PHP 5.1.6 (mandriva 2007) with not problem, then we ugraded to PHP 5.2.5 (mandriva 2008 or 2008.1) on new server and suddenly our BLOB fiels (is a small image) are not being returned. I have verified that they still store properly in the Firebird 2.0 database. No problem with the other functions.
If i downgrade back to PHP 5.1.6 (mandriva 2007) on new sever, the problem is fixed.
Other Interbase/Firebird functions are working well.
Thank's for your feeback.






Reproduce code:
---------------
The table in dbtest.fdb:
CREATE TABLE DF_ETAT (
ETAT_NO  SMALLINT NOT NULL,
ICONE   BLOB SUB_TYPE 0 SEGMENT SIZE 80,
);

The php file : test.php
<? 
header('Content-type: image/png');
$dbi = ibase_connect('db_server:/data/dbtest.fdb','SYSDBA','masterkey','NONE');
$sql = "SELECT ICONE FROM DF_ETAT WHERE ETAT_NO=20";
$sth = ibase_query($dbi,$sql);
$row = ibase_fetch_object($sth);
$blob = ibase_blob_echo($row->ICONE);
$ibase_close($dbi);
?>

Expected result:
----------------
I expected to see my BLOB fields on the web page test.php

Actual result:
--------------
I didn't see my BLOB fields.
Error log message for httpd return :
[error] [client 192.168.1.57] PHP Warning:  ibase_blob_echo() [<a href='function.ibase-blob-echo'>function.fbird-blob-echo</a>]: BLOB not found  in /var/www/html/test.php on line 6


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-16 07:57 UTC] ale dot pas at tiscali dot it
Might be related with
http://bugs.php.net/bug.php?id=42266

this just adds a record to the long list of firebird blob related bugs introduced after 5.2.1
 [2008-10-21 11:27 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-10-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2014-02-11 03:48 UTC] ffortuny at gmail dot com
Here is the code:

function glGetPic2()
{
  $sql = "select
 a.id, a.descri, a.url, b.purpose, a.pic, a.mime
from glpics a
left outer join picpurps b on b.idpurp=a.idpurp
where a.iden = ".$_REQUEST["iden"]."
and a.idtabla = ".$_REQUEST["idtabla"];
 $con = ibase_connect("glpics","sysdba","kliam56") or die(ibase_errmsg()." No se pudo conectar a la base glpics");
 $res = ibase_query($con,$sql);
 while($dat = ibase_fetch_row($res))
 {
   echo "<div style='width:65%;margin:0 auto 0 auto;' >";
   if(strlen($dat[2]) > 0)
   {
     // se trata de un URL
     echo "<img style='width:90%;display:block;margin:0 auto 0 auto' src=\"".$dat[2]."\" />";
   }
   else {
     // se trata de un blob
    /* $bi = ibase_blob_info($dat[4]);
     $ln = $bi["length"];
     $bo = ibase_blob_open($dat[4]);
     $pblo = ibase_blob_get($bo,$ln);
     ibase_blob_close($bo);
     $fp = fopen("/home/lazaro/public_html/img/glpic".$dat[0].".jpg","w");
     fputs($fp,$pblo,$ln);
     fclose($fp);
     echo "<img style='width:90%;display:block;margin:0 auto 0 auto' src='img/glpic".$dat[0].".jpg' >";*/
    header("Content-Type: ".$dat[5]);
    ibase_blob_echo($dat[4]);
    
   }
   echo "<p>".$dat[1]."&nbsp;(".$dat[3].")</p></div>";
 }
}

As I receive the data, it comes in the form of characters from the content of the blob. My text is properly inserted. It is received through ajax, but the result in a direct URL is just as wrong, except that it wants to save the page.

It definitely doesn't show the images. They're all jpg now.
 [2014-02-11 04:05 UTC] requinix@php.net
@ffortuny:
This is not the place to get help with your code. Please take your questions to a mailing list or online forum, where they will tell you about how you can't output HTML and image data at the same time.
http://www.php.net/support.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC