From: Operating system: Ubuntu 10.04 PHP version: 5.3.5 Package: PDO related Bug Type: Bug Bug description:segfault in $stmt->execute()
Description: ------------ The snippet of code shown used is a method from a class that subclasses Zend_Db_Adapter_Abstract. We make a lot of query() calls, so caching prepared statements reportedly gives us a 10% performance improvement. #! /bin/sh # # Created by configure './configure' \ '--with-mysqli=mysqlnd' \ '--with-pdo-mysql=mysqlnd' \ '--with-zlib' \ '--enable-zip' \ '--with-gd' \ '--with-curl' \ '--enable-mbstring' \ '--enable-debug' \ "$@" Test script: --------------- public function query($sql, $bind = array()) { static $cachePreparedStatement = array(); if(isset($cachePreparedStatement[$sql])) { if (!is_array($bind)) { $bind = array($bind); } $stmt = $cachePreparedStatement[$sql]; $stmt->execute($bind); return $stmt; } $stmt = parent::query($sql, $bind); $cachePreparedStatement[$sql] = $stmt; return $stmt; } Expected result: ---------------- No crash. Actual result: -------------- Program received signal SIGSEGV, Segmentation fault. 0x003c7816 in ?? () from /lib/tls/i686/cmov/libc.so.6 (gdb) bt #0 0x003c7816 in ?? () from /lib/tls/i686/cmov/libc.so.6 #1 0x082818c6 in do_fetch (stmt=0x99cb938, do_bind=1, return_value=0x8f5c78c, how=PDO_FETCH_ASSOC, ori=PDO_FETCH_ORI_NEXT, offset=0, return_all=0x0) at /home/apang/work/php/php-5.3.5/ext/pdo/pdo_stmt.c:1044 #2 0x082825a2 in zim_PDOStatement_fetch (ht=3, return_value=0x8f5c78c, return_value_ptr=0x0, this_ptr=0xb7ecba54, return_value_used=1) at /home/apang/work/php/php-5.3.5/ext/pdo/pdo_stmt.c:1316 #3 0x08501e58 in zend_do_fcall_common_helper_SPEC (execute_data=0x8bd0dc0) at /home/apang/work/php/php-5.3.5/Zend/zend_vm_execute.h:316 #4 0x08502415 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0x8bd0dc0) at /home/apang/work/php/php-5.3.5/Zend/zend_vm_execute.h:421 #5 0x085014f5 in execute (op_array=0x971d190) at /home/apang/work/php/php-5.3.5/Zend/zend_vm_execute.h:107 #6 0x084c6e07 in zend_call_function (fci=0xbfffce28, fci_cache=0xbfffce4c) at /home/apang/work/php/php-5.3.5/Zend/zend_execute_API.c:964 #7 0x083849e1 in zif_call_user_func_array (ht=2, return_value=0x9a03db0, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at /home/apang/work/php/php-5.3.5/ext/standard/basic_functions.c:4796 #8 0x08501e58 in zend_do_fcall_common_helper_SPEC (execute_data=0x8bcffdc) at /home/apang/work/php/php-5.3.5/Zend/zend_vm_execute.h:316 #9 0x08505918 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x8bcffdc) at /home/apang/work/php/php-5.3.5/Zend/zend_vm_execute.h:1606 #10 0x085014f5 in execute (op_array=0x8e7bd1c) ---Type <return> to continue, or q <return> to quit--- at /home/apang/work/php/php-5.3.5/Zend/zend_vm_execute.h:107 #11 0x084d488e in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/apang/work/php/php-5.3.5/Zend/zend.c:1194 #12 0x0846a4ee in php_execute_script (primary_file=0xbffff2e4) at /home/apang/work/php/php-5.3.5/main/main.c:2265 #13 0x08592c71 in main (argc=2, argv=0xbffff474) at /home/apang/work/php/php-5.3.5/sapi/cli/php_cli.c:1193 -- Edit bug report at http://bugs.php.net/bug.php?id=53716&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53716&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53716&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53716&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53716&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53716&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53716&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53716&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53716&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53716&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53716&r=support Expected behavior: http://bugs.php.net/fix.php?id=53716&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53716&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53716&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53716&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53716&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53716&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53716&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53716&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53716&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53716&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53716&r=mysqlcfg