From:             
Operating system: Linux 2.6.18 Centos 5.7
PHP version:      5.3.10
Package:          PDO related
Bug Type:         Bug
Bug description:"Segment Fault" executing a prepared statement with PDO-Mysql

Description:
------------
Now I'm using php-5.3.10.

Executing a prepared sql statemente with pdo-mysql produces a "Segmento
Fault" error.

The configure line used to compile php is:
./configure \
--prefix=/usr/lib/php-5.3.10 \
--exec-prefix=/usr/lib/php-5.3.10 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/etc \
--enable-zip \
--enable-debug \
--with-curl=/usr/local \
--with-readline \
--enable-mbstring \
--with-mysqli=mysqlnd \
--with-pdo-mysql \
--with-mysql-sock=/var/lib/mysql/mysqld.sock \
--with-openssl \
--with-zlib \
--with-gd


Test script:
---------------
<?php
$dbh = new PDO('mysql:host=localhost;dbname=acceso', 'dbuser', 'dbpass');
$sql = 'INSERT INTO user (id, nombre, login, passwd) VALUES (?, ?, ?, ?)';
$stm = $dbh->prepare($sql);
$stm->bindValue(1, 0);
$stm->bindValue(2, 'Name, Last Name, etc. etc.');
$stm->bindValue(3, 'log_name');
$stm->bindValue(4, SHA1('log_name', FALSE));
$stm->execute();
echo 'New user record saved in DB';
?>

Expected result:
----------------
Echoed 'New user record saved in DB' and a new record in "user" table.

Actual result:
--------------
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5_7.1)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/php...done.
(gdb) run ExecutePrepared.php
Starting program: /usr/bin/php ExecutePrepared.php
warning: .dynamic section for "/lib/libc.so.6" is not at the expected
address
warning: difference appears to be caused by prelink, adjusting
expectations
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x08325563 in mysqlnd_cset_escape_slashes (cset=0x0, newstr=0x89db217 "p",
escapestr=0x89dca6c "Name, Last name, etc., etc.",
    escapestr_len=27) at
/d/software/Php/php-5.3.10/ext/mysqlnd/mysqlnd_charset.c:718
718                     if (cset->char_maxlen > 1 && (len =
cset->mb_valid(escapestr, end))) {
(gdb) bt
#0  0x08325563 in mysqlnd_cset_escape_slashes (cset=0x0, newstr=0x89db217
"p", escapestr=0x89dca6c "Name, Last name, etc., etc.",
    escapestr_len=27) at
/d/software/Php/php-5.3.10/ext/mysqlnd/mysqlnd_charset.c:718
#1  0x081f6a55 in mysql_handle_quoter (dbh=0x89dc118, unquoted=0x89dca6c
"Name, Last name, etc., etc.", unquotedlen=27,
    quoted=0x89de1a0, quotedlen=0x89de19c, paramtype=PDO_PARAM_STR) at
/d/software/Php/php-5.3.10/ext/pdo_mysql/mysql_driver.c:337
#2  0x081f5f89 in pdo_parse_params (stmt=0x89ddbec,
    inquery=0x89ddd0c "INSERT INTO user (id, nombre, login, passwd) VALUES
(?, ?, ?, ?)", inquery_len=64, outquery=0x89ddc38,
    outquery_len=0x89ddc3c) at
/d/software/Php/php-5.3.10/ext/pdo/pdo_sql_parser.c:585
#3  0x081f2d59 in zim_PDOStatement_execute (ht=0, return_value=0x89ddeec,
return_value_ptr=0x0, this_ptr=0x89dc1ec,
    return_value_used=0) at
/d/software/Php/php-5.3.10/ext/pdo/pdo_stmt.c:497
#4  0x083b2619 in zend_do_fcall_common_helper_SPEC
(execute_data=0x8a0dcc8)
    at /d/software/Php/php-5.3.10/Zend/zend_vm_execute.h:320
#5  0x083b1ca8 in execute (op_array=0x89db224) at
/d/software/Php/php-5.3.10/Zend/zend_vm_execute.h:107
#6  0x0838ced7 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /d/software/Php/php-5.3.10/Zend/zend.c:1236
#7  0x0833b5de in php_execute_script (primary_file=0xbfffe5ac) at
/d/software/Php/php-5.3.10/main/main.c:2308
#8  0x0840f37b in main (argc=2, argv=0xbfffe714) at
/d/software/Php/php-5.3.10/sapi/cli/php_cli.c:1184



-- 
Edit bug report at https://bugs.php.net/bug.php?id=61259&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=61259&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=61259&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=61259&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=61259&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=61259&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=61259&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=61259&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=61259&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=61259&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=61259&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=61259&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=61259&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=61259&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=61259&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=61259&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61259&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=61259&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=61259&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=61259&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=61259&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=61259&r=mysqlcfg

Reply via email to