|  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
 [2006-09-10 16:45 UTC] unixy at hotmail dot com
PHP 5.1.4
MySQL 5.0.18

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, which may make this a mysql problem?

Reproduce code:
$res=new PDO('mysql:host=x;dbname=x','user','pwd'

$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.

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

0xb70ccc07 in mysql_more_results () from /usr/lib/
(gdb) bt
#0  0xb70ccc07 in mysql_more_results () from /usr/lib/
#1  0xb70b2e81 in pdo_row_new () from /usr/lib/php5/extensions/
#2  0xb78e03dd in zend_objects_store_free_object_storage () from /usr/lib/apache2/
#3  0xb78bbd6d in shutdown_executor () from /usr/lib/apache2/
#4  0xb78c6873 in zend_deactivate () from /usr/lib/apache2/
#5  0xb7889500 in php_request_shutdown () from /usr/lib/apache2/
#6  0xb793d69c in php_ap2_register_hook () from /usr/lib/apache2/
#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


Add a Patch

Pull Requests

Add a Pull Request


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)");

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 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-2021 The PHP Group
All rights reserved.
Last updated: Sat Nov 27 08:03:12 2021 UTC