php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57225 Stored procedure execution causes segfault
Submitted: 2006-09-10 16:45 UTC Modified: 2006-09-12 08:52 UTC
From: unixy at hotmail dot com Assigned:
Status: Not a bug Package: PDO_MYSQL (PECL)
PHP Version: 5.1.4 OS: Linux 2.6
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: unixy at hotmail dot com
New email:
PHP Version: OS:

 

 [2006-09-10 16:45 UTC] unixy at hotmail dot com
Description:
------------
Description
-----------
PHP 5.1.4
MySQL 5.0.18
Apache2

Maybe unfounded reporting the bug, but it can be reproduced across all of our unix machines. Only workaround so far is to have the procedure dump results in a temporary table and select from that. Im not a programmer, but the backtrace mentions libmysqlclient.so, which may make this a mysql problem?

Reproduce code:
---------------
<?php
$res=new PDO('mysql:host=x;dbname=x','user','pwd'
,array( PDO::MYSQL_ATTR_USE_UNBUFFERED_QUERY=>true, PDO::ATTR_EMULATE_PREPARES=>true));

$var=10;
$rh=$res->prepare("CALL some_sp(?)");
$rh->execute( array( $var ) );         <--segfault

$res->query("CALL some_sp(10)");       <--Also segfault
?>

Expected result:
----------------
Expect to be able to use fetch()/fetchAll() to get returned rows from the stored procedure execution.

Actual result:
--------------
Apache process dies with the following entry in error_log. No output to the browser.

LOG:
[notice] child pid 6818 exit signal Segmentation fault (11)

BACKTRACE (gdb):
0xb70ccc07 in mysql_more_results () from /usr/lib/libmysqlclient.so.15
(gdb) bt
#0  0xb70ccc07 in mysql_more_results () from /usr/lib/libmysqlclient.so.15
#1  0xb70b2e81 in pdo_row_new () from /usr/lib/php5/extensions/pdo.so
#2  0xb78e03dd in zend_objects_store_free_object_storage () from /usr/lib/apache2/mod_php5.so
#3  0xb78bbd6d in shutdown_executor () from /usr/lib/apache2/mod_php5.so
#4  0xb78c6873 in zend_deactivate () from /usr/lib/apache2/mod_php5.so
#5  0xb7889500 in php_request_shutdown () from /usr/lib/apache2/mod_php5.so
#6  0xb793d69c in php_ap2_register_hook () from /usr/lib/apache2/mod_php5.so
#7  0x8002f6bd in ap_run_handler () from /usr/sbin/httpd2
#8  0x80032f88 in ap_invoke_handler () from /usr/sbin/httpd2
#9  0x8003ec1e in ap_process_request () from /usr/sbin/httpd2
#10 0x8003b9b8 in ap_register_input_filter () from /usr/sbin/httpd2
#11 0x8003726d in ap_run_process_connection () from /usr/sbin/httpd2
#12 0x8003736c in ap_process_connection () from /usr/sbin/httpd2
#13 0x80043294 in ap_graceful_stop_signalled () from /usr/sbin/httpd2
#14 0x80043504 in ap_graceful_stop_signalled () from /usr/sbin/httpd2
#15 0x80044419 in ap_mpm_run () from /usr/sbin/httpd2
#16 0x8001ae47 in main () from /usr/sbin/httpd2



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-12 08:52 UTC] unixy at hotmail dot com
After testing using as many methods of fetching from stored procedure output as I can think of, i have resolved that:

$rh=$res->query("CALL sp(10)");
$row=$rh->fetch();

Is working. Please disregard the bug report, as a lengthy prepared statement of plain SQL ( no sp, trig or functions ) is causing the segfault when executed in libmysql.so. Either way this is not a PDO bug and appears to be a libmysql backend bug which I will pass on providing my SQL is correct.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 14:01:25 2019 UTC