php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71175 Crash when use ibase_blob_echo
Submitted: 2015-12-20 22:32 UTC Modified: 2017-02-06 14:09 UTC
From: zedex at rambler dot ru Assigned: mariuz (profile)
Status: Closed Package: InterBase related
PHP Version: 7.0.1 OS: Linux SLES-11 SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 + 13 = ?
Subscribe to this entry?

 
 [2015-12-20 22:32 UTC] zedex at rambler dot ru
Description:
------------
Can't select blob data from data field (FireBird 2.5.5). 
In PHP 5.6.16 all working perfect !
if use print function result simple is: 0x00000500080

Test script:
---------------
<?
$host = 'localhost:/opt/firebird/examples/test.fdb';
$username = 'sysdba';
$password = 'password';

$dbh = ibase_connect($host, $username, $password);
$query = "SELECT B_DATA FROM TEST2 WHERE ID='9'";
$result = ibase_query($dbh, $query);
$data = ibase_fetch_object($result);
if ($data) {
  header("Content-type: application/pdf");
  header('Content-disposition: attachment; filename="test.pdf"');
  ibase_blob_echo($data->B_DATA);
} else { header('HTTP/1.0 404 Not Found'); }
ibase_close($dbh);
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-21 04:19 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2015-12-21 04:19 UTC] laruence@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2015-12-21 13:24 UTC] zedex at rambler dot ru
-Status: Feedback +Status: Open
 [2015-12-21 13:24 UTC] zedex at rambler dot ru
(gdb) bt

#0  0x00000000008b1997 in zend_fetch_resource2 (res=0x4,
 
   resource_type_name=0xd6ec97 "InterBase link", resource_type1=7,
 
   resource_type2=8) at /home/zedex/install/php-7.0.1/Zend/zend_list.c:106

#1  0x000000000064331c in zif_ibase_blob_echo (execute_data=0x7ffff60141d0,
 
   return_value=0x7ffff60141b0)

    at /home/zedex/install/php-7.0.1/ext/interbase/ibase_blobs.c:501

#2  0x00000000008f8899 in ZEND_DO_ICALL_SPEC_HANDLER (

    execute_data=0x7ffff6014030)

    at /home/zedex/install/php-7.0.1/Zend/zend_vm_execute.h:586

#3  0x00000000008f7f24 in execute_ex (ex=0x7ffff6014030)

    at /home/zedex/install/php-7.0.1/Zend/zend_vm_execute.h:417

#4  0x00000000008f815b in zend_execute (op_array=0x7ffff6085000,
 
   return_value=0x0)

    at /home/zedex/install/php-7.0.1/Zend/zend_vm_execute.h:458

#5  0x0000000000897209 in zend_execute_scripts (type=8, retval=0x0,
 
   file_count=3) at /home/zedex/install/php-7.0.1/Zend/zend.c:1428

#6  0x00000000007d4954 in php_execute_script (primary_file=0x7fffffffdba0)

    at /home/zedex/install/php-7.0.1/main/main.c:2471

#7  0x000000000096bd2d in do_cli (argc=2, argv=0x1100700)

    at /home/zedex/install/php-7.0.1/sapi/cli/php_cli.c:974

#8  0x000000000096cf49 in main (argc=2, argv=0x1100700)

    at /home/zedex/install/php-7.0.1/sapi/cli/php_cli.c:1345

(gdb)
 [2015-12-21 14:10 UTC] laruence@php.net
Hmm, seems this is broken, I doubt it even work at the first step...

anyway, I made a patch, but I don't have env to test it, could you please check whether it works?

https://gist.github.com/laruence/f3af903012902818d7da
 [2015-12-21 14:24 UTC] laruence@php.net
sorry, it turns out this extension is broken, far away from working..

it's no need to test the patch I paste... thanks :<
 [2015-12-21 14:44 UTC] laruence@php.net
-Status: Open +Status: Verified
 [2015-12-21 14:57 UTC] lester at lsces dot co dot uk
Try again from phone ...
Extension is working fine for me in PHP7 ... looks like it's simply returning the blob ID rather than the text, so suspect the default setting changed? There are warnings compiling, but it passes all of the test suite and the firebird test suite so don't understand why there is a problem here.
 [2015-12-21 16:29 UTC] zedex at rambler dot ru
TO: lester at lsces dot co dot uk
I'm don't saying what extention not workin. I'm have a trouble only at this function :)
TO: laruence@php.net
I'm appling your patch and function begin workin ! Thank you very much !
 [2015-12-22 00:20 UTC] lester at lsces dot co dot uk
If I apply the patch then I get a compile failure with ....

In file included from /opt/php-7.0.1/Zend/zend_API.h:28:0,
                 from /opt/php-7.0.1/main/php.h:39,
                 from /opt/php-7.0.1/ext/interbase/interbase.c:27:
/opt/php-7.0.1/Zend/zend_list.h:66:16: note: expected ‘struct zval *’ but argument is of type ‘struct zend_resource *’
 ZEND_API void *zend_fetch_resource2_ex(zval *res, const char *resource_type_name, int resource_type, int resource_type2);

http://php7.lsces.org.uk/ is now running with 7.0.1 quite happily but it took a while to sort out compiling the update. I can now check out the test script ...
 [2017-02-06 14:09 UTC] mariuz@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: mariuz
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC