php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47874 crash while prepare statement
Submitted: 2009-04-02 08:32 UTC Modified: 2009-12-16 01:00 UTC
Votes:5
Avg. Score:4.8 ± 0.4
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: jan dot schmidt at vitronic dot de Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.2.9 OS: Win XP SP3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jan dot schmidt at vitronic dot de
New email:
PHP Version: OS:

 

 [2009-04-02 08:32 UTC] jan dot schmidt at vitronic dot de
Description:
------------
I'm running an Apache 2.2.9 Webserver and a MySQL 5.1.31 Database and want to insert a lot of rows over PDO MySQL Extension. But if the testscript is very often requested, php crashes while preparing a statement.

I find out that the easiest way to reproduce the crash is to open the testscript in firefox and keep the F5 Key pressed.

For the backtrace i used the php 5.2 snap from 2009-04-01.

Only the pdo and pdo_mysql extensions are loaded.

Reproduce code:
---------------
<?php
$dbhandle = new PDO('mysql:host=localhost', 'root', 'mypass',array(PDO::ATTR_PERSISTENT => true));
$dbhandle->exec('SET CHARACTER SET utf8');
$dbhandle->exec('CREATE DATABASE testdb');
$dbhandle->exec('CREATE TABLE testdb.testtable(id bigint(20) NOT NULL AUTO_INCREMENT, testcol text collate utf8_unicode_ci NOT NULL, PRIMARY KEY(id))');
for($i = 0;$i < 100;$i++)
{
    $stmt = $dbhandle->prepare('INSERT INTO testdb.testtable (testcol) VALUES (:testcol)');
    $stmt->bindValue(':testcol','testentrie nr '.$i,PDO::PARAM_STR);
    $stmt->execute();
}
?>

Expected result:
----------------
Script insert 100 rows to Table testtable.

Actual result:
--------------
Script Crashes

Backtrace:

_zend_mm_free_int(_zend_mm_heap * 0x0110faf8, void * 0x002e0000) line 1974 + 132 bytes
_efree(void * 0x00fb5200) line 2306 + 11 bytes
_zval_ptr_dtor(_zval_struct * * 0x0558fa8c) line 415 + 37 bytes
zend_std_write_property(_zval_struct * 0x015e2b9a, _zval_struct * 0x05d6d530, _zval_struct * 0x00fb5200, void * * * 0x05d6d230) line 417 + 12 bytes
pdo_stmt_construct(_pdo_stmt_t * 0x015e2a0d, _zval_struct * 0x05d6d348, _zend_class_entry * 0x05d6d530, _zval_struct * 0x00fb5090, void * * * 0x00000000) line 447
zim_PDO_prepare(int 7916969, _zval_struct * 0x00fb5090, _zval_struct * * 0x05d6d530, _zval_struct * 0x00000000, int 93948008, void * * * 0x00000001) line 581 + 22 bytes
zend_do_fcall_common_helper_SPEC(_zend_execute_data * 0x0078c5c5, void * * * 0x0558fbb0) line 200 + 61 bytes
ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data * 0x0558fbb0, void * * * 0x0110ece0) line 322 + 17 bytes
execute(_zend_op_array * 0x0082e6fd, void * * * 0x00000008) line 92 + 12 bytes
php_execute_script(_zend_file_handle * 0x05d6d4dc, void * * * 0x00000000) line 2023 + 18 bytes
05d6d19c()
05d6d190()
PHP_PDO! pdo_row_object_handlers + 200 bytes


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-03 19:39 UTC] johannes@php.net
Please check that a 5.0 libmysql.dll is being loaded, not the 5.1 version from the server, see phpinfo() output.
 [2009-04-06 07:09 UTC] jan dot schmidt at vitronic dot de
I'm sure the 5.0 is loaded:

phpinfo:
----
pdo_mysql
PDO Driver for MySQL, client library version	5.0.51a
----

I've tested already the 5.3 because of the native mysql driver.

phpinfo of PHP Version 5.3.0beta2-dev: 
----
pdo_mysql
PDO Driver for MySQL	enabled
Client API version 	mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.22 $ 
----

but this configuration crashed too.
 [2009-04-06 07:16 UTC] pajoye@php.net
5.3 does not use the libmysql library. Check your PATH, the PHP directory has to be 1st in the list, before MySQL.

Does it happen in CLI too?
 [2009-04-06 09:12 UTC] jan dot schmidt at vitronic dot de
The PHP Directory is the first in the list.

I can't reproduce it in CLI.
 [2009-04-30 10:47 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-04-30 12:34 UTC] jan dot schmidt at vitronic dot de
Thanks for reply,

but unfortunately the CVS Snap shows the same behavior like the Version before.

Backtrace with newest CVS Snap:
(Build Date 	Apr 26 2009 23:39:22)

_zend_mm_free_int(_zend_mm_heap * 0x010a9c60, void * 0x002e0000) line 1984
_efree(void * 0x00fb4cc0) line 2311 + 11 bytes
_zval_ptr_dtor(_zval_struct * * 0x055cfa8c) line 415 + 37 bytes
zend_std_write_property(_zval_struct * 0x015e2b9a, _zval_struct * 0x0581d3a8, _zval_struct * 0x00fb4cc0, void * * * 0x0581d390) line 417 + 12 bytes
pdo_stmt_construct(_pdo_stmt_t * 0x015e2a0d, _zval_struct * 0x0581d4a8, _zend_class_entry * 0x0581d3a8, _zval_struct * 0x00fb4b50, void * * * 0x00000000) line 447
zim_PDO_prepare(int 7916953, _zval_struct * 0x00fb4b50, _zval_struct * * 0x0581d3a8, _zval_struct * 0x00000000, int 17881808, void * * * 0x00000001) line 581 + 22 bytes
zend_do_fcall_common_helper_SPEC(_zend_execute_data * 0x0078c5b5, void * * * 0x055cfbb0) line 200 + 61 bytes
ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data * 0x055cfbb0, void * * * 0x010a8a00) line 322 + 17 bytes
execute(_zend_op_array * 0x0082d01d, void * * * 0x00000008) line 92 + 12 bytes
php_execute_script(_zend_file_handle * 0x0581d63c, void * * * 0x00000000) line 2023 + 18 bytes
0581d2fc()
0581d2f0()
PHP_PDO! pdo_row_object_handlers + 200 bytes
 [2009-12-08 23:19 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-12-16 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 10:01:33 2025 UTC