php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36402 PDO_MYSQL prepared statements cause Out of memory or data corruption
Submitted: 2006-02-15 15:02 UTC Modified: 2006-04-19 01:00 UTC
Votes:14
Avg. Score:4.6 ± 0.6
Reproduced:14 of 14 (100.0%)
Same Version:8 (57.1%)
Same OS:9 (64.3%)
From: joh at deworks dot net Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5CVS-2006-02-15 (snap) OS: Linux
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: joh at deworks dot net
New email:
PHP Version: OS:

 

 [2006-02-15 15:02 UTC] joh at deworks dot net
Description:
------------
PDO_MYSQL prepared statement INSERTs either result in corrupt data or SQLSTATE[HY000]: General error: 5 Out of memory (Needed 4261477896 bytes)

This works perfectly with PDO_SQLITE.

Reproduce code:
---------------
CREATE TABLE test (id INT PRIMARY KEY AUTO_INCREMENT, col1 VARCHAR(255), col2 VARCHAR(255), col3 VARCHAR(255), col4 VARCHAR(255), col5 VARCHAR(255));



$dbh = new PDO('mysql:host=localhost;dbname=...', '...', '...');
$sql = 'INSERT INTO test(col1, col2, col3, col4, col5) VALUES(:col1, :col2, :col3, :col4, :col5)';
$stmt = DB::$dbh->prepare($sql);
$col1 = 'TestCol1';
$col2 = 'TestCol2';
$col3 = 'TestCol3';
$col4 = 'TestCol4';
$col5 = 'TestCol5';
$stmt->bindParam(':col1', $col1);
$stmt->bindParam(':col2', $col2);
$stmt->bindParam(':col3', $col3);
$stmt->bindParam(':col4', $col4);
$stmt->bindParam(':col5', $col5);
$stmt->execute();

Expected result:
----------------
No outupt, mysql table test contains rows according to the query.

Actual result:
--------------
Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query' in file.php:125
Stack trace:
#0 file.php(125): PDOStatement->execute()
#1 {main}
  thrown in file.php on line 125

Decreasing the number of parameters to 4 (col1, col2, col3, col4) results in:
Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 5 Out of memory (Needed 4261477896 bytes)' in file.php:141
Stack trace:
#0 file.php(141): PDOStatement->execute()
#1 {main}
  thrown in file.php on line 141

Decreasing the number of parameters to 3 or less (here: col1, col2, col3) results in a successfull query, but corrupt inserted data:

mysql> SELECT * FROM test;
+----+------+------+------+------+------+
| id | col1 | col2 | col3 | col4 | col5 |
+----+------+------+------+------+------+
|  2 |      | \uffff    |      | NULL | NULL |
+----+------+------+------+------+------+
1 row in set (0.00 sec)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-15 15:04 UTC] joh at deworks dot net
Forgot to mention that I'm running MySQL 4.1.12
 [2006-02-15 16:45 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-02-15 22:20 UTC] joh at deworks dot net
I've tried the latest snapshot (I tried it before I reported this bug), and the problem still persists. Sorry.
 [2006-02-23 00:07 UTC] joh at deworks dot net
So was anything done about this, or was it forgotten? Status report?
 [2006-04-06 13:48 UTC] czw at home dot se
Got the same error: PHP 5.1.2, MySQL 4.1.14. This error is 
NOT present in PHP 5.1.1. I would suggest downgrading.
 [2006-04-09 07:52 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-04-09 14:10 UTC] joh at deworks dot net
Just tested with the latest snapshot (php5.1-200604091030), and the problem still persists.
 [2006-04-11 02:32 UTC] wez@php.net
Please try configuring PHP using:
  --disable-zend-memory-manager
and then run the PHP script under valgrind from the CLI:

% ./configure ... --disable-zend-memory-manager --enable-cli
% make
% valgrind --tool=memcheck ./sapi/cli/php myscript.php

You can find valgrind at http://valgrind.org/.

This should highlight memory corruption issues.
 [2006-04-19 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".
 [2006-09-20 05:46 UTC] ayuzhakov at swsoft dot com
Have the same problem.

OS:
------------
root@c-ubn51:~/php/php5.2-200609200230# uname -a
Linux c-ubn51.sbvz.plesk.ru 2.6.8-022stab070.9-smp #1 SMP Thu Apr 20 10:35:42 MSD 2006 i686 GNU/Linux
root@c-ubn51:~/php/php5.2-200609200230# cat /etc/issue
Ubuntu 5.10 "Breezy Badger" \n \l

PHP version:
------------
PHP 5.1.1
PHP 5.1.4
PHP 5.1.6
PHP 5.2-200609200230 (snapshot)

All these versions have this bug.

MySQL server version:
------------
4.1.12-1ubuntu3.7 (native).

If I try to use MySQL 4.0.24-10ubuntu2.3 (native) or MySQL 4.1.12 (binaries from mysql.com), then it works fine.
 [2006-09-20 05:53 UTC] ayuzhakov at swsoft dot com
PHP configured with --disable-zend-memory-manager

root@c-ubn51:~/php/php5.2-200609200230# valgrind --tool=memcheck ./sapi/cli/php ./test.php

==30665== Memcheck, a memory error detector.
==30665== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==30665== Using LibVEX rev 1367, a library for dynamic binary translation.
==30665== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==30665== Using valgrind-3.0.1, a dynamic binary instrumentation framework.
==30665== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==30665== For more details, rerun with: -v
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C7D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EA24D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E483C: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4908: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E72F0: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8F254A: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4CE6: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4796: (within /lib/ld-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C8C: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EA24D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E483C: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4908: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E72F0: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8F254A: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4CE6: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4796: (within /lib/ld-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C9B: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EA24D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E483C: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4908: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E72F0: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8F254A: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4CE6: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4796: (within /lib/ld-2.3.5.so)
--30665-- DWARF2 CFI reader: unhandled CFI instruction 0:50
--30665-- DWARF2 CFI reader: unhandled CFI instruction 0:50
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8EC82D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E6403: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8F254A: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4CE6: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4796: (within /lib/ld-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8EC852: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E6403: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8F254A: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4CE6: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4796: (within /lib/ld-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8EC6F7: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E6455: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8F254A: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4CE6: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4796: (within /lib/ld-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8EC700: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E6455: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8F254A: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4CE6: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4796: (within /lib/ld-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8EC852: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E6455: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8F254A: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4CE6: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8E4796: (within /lib/ld-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C3E: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EA24D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BD4ECEC: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BD4F2FA: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1BD4ED3C: dlopen (in /lib/tls/libdl-2.3.5.so)
==30665==    by 0x822F15C: php_dl (dl.c:140)
==30665==    by 0x82AB133: php_load_function_extension_cb (php_ini.c:235)
==30665==    by 0x82DCDB8: zend_llist_apply (zend_llist.c:191)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C4D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EA24D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BD4ECEC: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BD4F2FA: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1BD4ED3C: dlopen (in /lib/tls/libdl-2.3.5.so)
==30665==    by 0x822F15C: php_dl (dl.c:140)
==30665==    by 0x82AB133: php_load_function_extension_cb (php_ini.c:235)
==30665==    by 0x82DCDB8: zend_llist_apply (zend_llist.c:191)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C5C: (within /lib/ld-2.3.5.so)
==30665==    by 0x1B8EA24D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BD4ECEC: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BD4F2FA: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1BD4ED3C: dlopen (in /lib/tls/libdl-2.3.5.so)
==30665==    by 0x822F15C: php_dl (dl.c:140)
==30665==    by 0x82AB133: php_load_function_extension_cb (php_ini.c:235)
==30665==    by 0x82DCDB8: zend_llist_apply (zend_llist.c:191)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8EC82D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DF79: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BD4ECEC: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BD4F2FA: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1BD4ED3C: dlopen (in /lib/tls/libdl-2.3.5.so)
==30665==    by 0x822F15C: php_dl (dl.c:140)
==30665==    by 0x82AB133: php_load_function_extension_cb (php_ini.c:235)
==30665==    by 0x82DCDB8: zend_llist_apply (zend_llist.c:191)
==30665==    by 0x82AB259: php_ini_register_extensions (php_ini.c:563)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8EC852: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DF79: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BD4ECEC: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BD4F2FA: (within /lib/tls/libdl-2.3.5.so)
==30665==    by 0x1BD4ED3C: dlopen (in /lib/tls/libdl-2.3.5.so)
==30665==    by 0x822F15C: php_dl (dl.c:140)
==30665==    by 0x82AB133: php_load_function_extension_cb (php_ini.c:235)
==30665==    by 0x82DCDB8: zend_llist_apply (zend_llist.c:191)
==30665==    by 0x82AB259: php_ini_register_extensions (php_ini.c:563)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4CE3: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE5002C: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE5010D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AB75: __nss_lookup_function (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2ACFE: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2C562: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30B15: getprotobyname_r (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30930: getprotobyname (in /lib/tls/libc-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4CEE: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE5002C: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE5010D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AB75: __nss_lookup_function (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2ACFE: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2C562: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30B15: getprotobyname_r (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30930: getprotobyname (in /lib/tls/libc-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4CF9: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE5002C: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE5010D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AB75: __nss_lookup_function (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2ACFE: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2C562: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30B15: getprotobyname_r (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30930: getprotobyname (in /lib/tls/libc-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4D04: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE5002C: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE5010D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AB75: __nss_lookup_function (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2ACFE: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2C562: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30B15: getprotobyname_r (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30930: getprotobyname (in /lib/tls/libc-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C3E: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE5002C: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE5010D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AB75: __nss_lookup_function (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AD26: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2C562: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30B15: getprotobyname_r (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30930: getprotobyname (in /lib/tls/libc-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C4D: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE5002C: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE5010D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AB75: __nss_lookup_function (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AD26: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2C562: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30B15: getprotobyname_r (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30930: getprotobyname (in /lib/tls/libc-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C5C: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE5002C: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE5010D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AB75: __nss_lookup_function (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AD26: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2C562: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30B15: getprotobyname_r (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30930: getprotobyname (in /lib/tls/libc-2.3.5.so)
==30665== 
==30665== Conditional jump or move depends on uninitialised value(s)
==30665==    at 0x1B8F4C6B: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4DE15: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE4EAB7: _dl_open (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE5002C: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1B8EF105: (within /lib/ld-2.3.5.so)
==30665==    by 0x1BE5010D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AB75: __nss_lookup_function (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2AD26: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE2C562: (within /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30B15: getprotobyname_r (in /lib/tls/libc-2.3.5.so)
==30665==    by 0x1BE30930: getprotobyname (in /lib/tls/libc-2.3.5.so)
PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query' in /opt/sitebuilder/include/Zend/Zend/Db/Adapter/Abstract.php:156
Stack trace:
#0 /opt/sitebuilder/include/Zend/Zend/Db/Adapter/Abstract.php(156): PDOStatement->execute(Array)
#1 /opt/sitebuilder/include/Zend/Zend/Db/Adapter/Abstract.php(227): Zend_Db_Adapter_Abstract->query('INSERT INTO log...', Array)
#2 /root/php/php5.2-200609200230/test.php(24): Zend_Db_Adapter_Abstract->insert('log', Array)
#3 {main}
  thrown in /opt/sitebuilder/include/Zend/Zend/Db/Adapter/Abstract.php on line 156
==30665== 
==30665== ERROR SUMMARY: 61 errors from 21 contexts (suppressed: 0 from 0)
==30665== malloc/free: in use at exit: 51908 bytes in 1248 blocks.
==30665== malloc/free: 15865 allocs, 14617 frees, 2032501 bytes allocated.
==30665== For counts of detected errors, rerun with: -v
==30665== searching for pointers to 1248 not-freed blocks.
==30665== checked 862980 bytes.
==30665== 
==30665== LEAK SUMMARY:
==30665==    definitely lost: 32704 bytes in 8 blocks.
==30665==      possibly lost: 0 bytes in 0 blocks.
==30665==    still reachable: 19204 bytes in 1240 blocks.
==30665==         suppressed: 0 bytes in 0 blocks.
==30665== Use --leak-check=full to see details of leaked memory.
 [2006-09-20 06:04 UTC] ayuzhakov at swsoft dot com
Also as reported in first comment if I have in INSERT:
  * 1,2,3 params - all ok
  * 4 params - failed with 'SQLSTATE[HY000]: General error: 5 Out of memory (Needed 4261477896 bytes)'
  * 5 or more params - failed with 'SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query'
 [2006-09-21 11:19 UTC] ayuzhakov at swsoft dot com
Reproduced on Ubuntu 6.06 with MySQL 4.1.15-1ubuntu5 (native).
 [2006-11-11 11:40 UTC] alexandre at objectdata dot com dot br
Fedora 1
kernel 2.4.22-1.2115.nptlsmp, glibc-2.3.2-101, mysql 4.1.21 compiled from source, php 5.1.4 compiled from source => no problem

Fedora 3
kernel 2.6.9-1.667, glibc-2.3.3-74, mysql 4.1.21 compiled from source, php 5.1.4 compiled from source => no problem

Fedora 5
kernel 2.6.17-1.2157_FC5, glibc-2.4-11, mysql 4.1.21 compiled from source, php 5.1.4 compield => reproduced problem

Fedora 6
kernel 2.6.18-1.2798.fc6, glibc-2.5-3, mysql 4.1.21 compield from source, php 5.1.4 compield from source => reproduced problem

SOLUTION
Fedora 6
install mysql-standrad-4.1.21 => compiled glibc 2.2 static <=
IS NOT A BUG FROM PHP, IS BUG FROM mysql client + glibc
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 23:01:31 2025 UTC