Bug #66762 [NEW]: Segfault in mysqli_stmt::bind_result() when link closed

From: Date: Mon, 24 Feb 2014 15:05:03 +0000
Subject: Bug #66762 [NEW]: Segfault in mysqli_stmt::bind_result() when link closed
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184390@lists.php.net to get a copy of this message
From: remi Operating system: GNU/Linux PHP version: 5.4.25 Package: MySQLi related Bug Type: Bug Bug description:Segfault in mysqli_stmt::bind_result() when link closed Description: ------------ Trying to use a Mysqli_Stmt object after the Mysql object is clean result in segfault. Notice: only with libmysqlclient (no segfault with mysqlnd). I haven't find a simple solution to check if the link oject is still valid from the stmt object... Test script: --------------- $mysqli = new mysqli($host, $user, $pass, $db); $read_stmt = $mysqli->prepare("SELECT 1"); $mysqli = null; $read_stmt->bind_result($data); Expected result: ---------------- no segfault. Actual result: -------------- Program received signal SIGSEGV, Segmentation fault. (gdb) bt #0 0x00007ffff7aedf3c in mysql_stmt_bind_result () from /usr/lib64/mysql/libmysqlclient.so.18 #1 0x0000000000474b59 in mysqli_stmt_bind_result_do_bind (start=0, argc=<optimized out>, args=0x7ffff7ab7cb8, stmt=0x7ffff7ab7560) at /tmp/php-5.5.9/ext/mysqli/mysqli_api.c:430 #2 zif_mysqli_stmt_bind_result (ht=<optimized out>, return_value=0x7ffff7ab8dd8, return_value_ptr=<optimized out>, this_ptr=<optimized out>, return_value_used=<optimized out>) at /tmp/php-5.5.9/ext/mysqli/mysqli_api.c:509 #3 0x000000000062667a in zend_do_fcall_common_helper_SPEC (execute_data=0x7ffff7a81260) at /tmp/php-5.5.9/Zend/zend_vm_execute.h:550 #4 0x00000000005a2b38 in execute_ex (execute_data=0x7ffff7a81260) at /tmp/php-5.5.9/Zend/zend_vm_execute.h:363 #5 0x000000000057c14d in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /tmp/php-5.5.9/Zend/zend.c:1316 #6 0x000000000051dae2 in php_execute_script (primary_file=primary_file@entry=0x7fffffffc8b0) at /tmp/php-5.5.9/main/main.c:2506 #7 0x0000000000628734 in do_cli (argc=2, argv=0x9be8b0) at /tmp/php-5.5.9/sapi/cli/php_cli.c:994 #8 0x000000000041a107 in main (argc=2, argv=0x9be8b0) at /tmp/php-5.5.9/sapi/cli/php_cli.c:1378 (gdb) #0 0x00007ffff7aedf3c in mysql_stmt_bind_result () from /usr/lib64/mysql/libmysqlclient.so.18 #1 0x0000000000474b59 in mysqli_stmt_bind_result_do_bind (start=0, argc=<optimized out>, args=0x7ffff7ab7cb8, stmt=0x7ffff7ab7560) at /tmp/php-5.5.9/ext/mysqli/mysqli_api.c:430 #2 zif_mysqli_stmt_bind_result (ht=<optimized out>, return_value=0x7ffff7ab8dd8, return_value_ptr=<optimized out>, this_ptr=<optimized out>, return_value_used=<optimized out>) at /tmp/php-5.5.9/ext/mysqli/mysqli_api.c:509 #3 0x000000000062667a in zend_do_fcall_common_helper_SPEC (execute_data=0x7ffff7a81260) at /tmp/php-5.5.9/Zend/zend_vm_execute.h:550 #4 0x00000000005a2b38 in execute_ex (execute_data=0x7ffff7a81260) at /tmp/php-5.5.9/Zend/zend_vm_execute.h:363 #5 0x000000000057c14d in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /tmp/php-5.5.9/Zend/zend.c:1316 #6 0x000000000051dae2 in php_execute_script (primary_file=primary_file@entry=0x7fffffffc8b0) at /tmp/php-5.5.9/main/main.c:2506 #7 0x0000000000628734 in do_cli (argc=2, argv=0x9be8b0) at /tmp/php-5.5.9/sapi/cli/php_cli.c:994 #8 0x000000000041a107 in main (argc=2, argv=0x9be8b0) at /tmp/php-5.5.9/sapi/cli/php_cli.c:1378 -- Edit bug report at https://bugs.php.net/bug.php?id=66762&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66762&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66762&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66762&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66762&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66762&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66762&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66762&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66762&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66762&r=support Expected behavior: https://bugs.php.net/fix.php?id=66762&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66762&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66762&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66762&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66762&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66762&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66762&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66762&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66762&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66762&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66762&r=mysqlcfg

« previous php.bugs (#184390) next »