ID: 48821
User updated by: margus at zone dot ee
Reported By: margus at zone dot ee
-Status: Feedback
+Status: Open
Bug Type: MySQL related
Operating System: CentOS 4.7/x86_64
PHP Version: 5.3.0
New Comment:
open
Previous Comments:
------------------------------------------------------------------------
[2009-07-22 15:30:11] erki at zone dot ee
Hello.
Actually, Margus was saying that CLI does not crash, that's why he
disabled CLI.
I tested this case a little further and discovered, that CLI also
crashes and this bug appears on x86_64 systems using GCC 3 and with GCC
optimization enabled.
Using GCC 4 or disabling GCC optimization fixes this bug.
These are my results on Debian (squeeze):
Configure lines:
---------------
CC=gcc-3.4 ./configure --disable-all --with-mysql [DOES
NOT WORK]
CC=gcc-3.4 CFLAGS=-O1 ./configure --disable-all --with-mysql [DOES
NOT WORK]
CC=gcc-3.4 CFLAGS=-O0 ./configure --disable-all --with-mysql
[WORKS]
CC=gcc-4.0 ./configure --disable-all --with-mysql
[WORKS]
Reproduce code:
---------------
sapi/cli/php -r "mysql_fetch_array (fopen ('php://stdin', 'r'),
MYSQL_BOTH);"
(I'm using fopen, because the first parameter must be some kind of
resource, but the actual value makes no difference)
Expected result:
----------------
Warning: mysql_fetch_array(): supplied resource is not a valid MySQL
result resource in Command line code on line 1
Actual result:
--------------
Segmentation fault
------------------------------------------------------------------------
[2009-07-21 22:08:52] [email protected]
Neither of the provided configure lines produce CLI binary, so how can
it crash?
------------------------------------------------------------------------
[2009-07-16 08:18:24] margus at zone dot ee
Configure line for SAPI:
'./configure' '--prefix=/opt/zone'
'--with-config-file-path=/etc/opt/zone/php53-module'
'--with-apxs2=/opt/zone/sbin/apxs'
'--with-mysql=/opt/zone/x86_64/configure-for-mysql51'
'--with-pdo-mysql=/opt/zone/x86_64/configure-for-mysql51'
'--with-pdo-sqlite' '--disable-cli' '--with-openssl=/usr/x86_64'
'--enable-mbstring' '--with-curl=/usr/x86_64' '--with-gd'
'--enable-exif' '--with-zlib-dir=/usr/x86_64'
'--with-png-dir=/usr/x86_64' '--with-jpeg-dir=/usr/x86_64'
'--with-freetype-dir=/usr/x86_64' '--disable-sockets'
'--with-iconv=/opt/zone/x86_64' '--without-pear'
'--with-libxml-dir=/opt/zone/x86_64' '--disable-phar'
------------------------------------------------------------------------
[2009-07-06 18:41:25] margus at zone dot ee
Configure line is quite traditional:
'./configure' '--prefix=/opt/zone'
'--with-config-file-path=/etc/opt/zone/php53-module'
'--with-apxs2=/opt/zone/sbin/apxs'
'--with-mysql=/opt/zone/x86_64/configure-for-mysql51'
'--with-pdo-mysql=/opt/zone/x86_64/configure-for-mysql51'
'--with-pdo-sqlite' '--disable-cli' '--with-openssl=/usr/x86_64'
'--enable-mbstring' '--with-curl=/usr/x86_64' '--with-gd'
'--enable-exif' '--with-zlib-dir=/usr/x86_64'
'--with-png-dir=/usr/x86_64' '--with-jpeg-dir=/usr/x86_64'
'--with-freetype-dir=/usr/x86_64' '--disable-sockets'
'--with-iconv=/opt/zone/x86_64' '--without-pear'
'--with-libxml-dir=/opt/zone/x86_64' '--disable-phar'
------------------------------------------------------------------------
[2009-07-06 17:19:00] [email protected]
What was the full configure line used to compile PHP?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/48821
--
Edit this bug report at http://bugs.php.net/?id=48821&edit=1