Edit report at http://bugs.php.net/bug.php?id=53716&edit=1

 ID:                 53716
 Updated by:         paj...@php.net
 Reported by:        anthon dot pang at gmail dot com
 Summary:            segfault in $stmt->execute()
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            PDO related
 Operating System:   Ubuntu 10.04
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.




Previous Comments:
------------------------------------------------------------------------
[2011-01-12 07:27:41] anthon dot pang at gmail dot com

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 this bug report at http://bugs.php.net/bug.php?id=53716&edit=1

Reply via email to