From: izh1979 at gmail dot com
Operating system: Linux 2.6.23.15-137.fc8
PHP version: 5.2.5
PHP Bug Type: Reproducible crash
Bug description: After mysql_close () "Invalid pointer" and "Segmentation
fault"
Description:
------------
PHP 5.2.5, MySQL 5.0.51a, for redhat-linux-gnu (i686) using EditLine
wrapper.
Running test script with correct user password, you will see:
Connected successfully.
[Thu Feb 28 18:04:59 2008] Script: '/home/bsg/www/t.php'
---------------------------------------
/home/user/php/ext/mysql/php_mysql.c(316) : Block 0x08f54820 status:
Invalid pointer: ((size=0x00000251) != (next.prev=0x00000000))
---------------------------------------
Disconnected successfully.
[Thu Feb 28 18:04:59 2008] Script: '/home/bsg/www/t.php'
---------------------------------------
/home/user/php/Zend/zend_opcode.c(238) : Block 0x08f554e8 status:
Invalid pointer: ((prev=0x00000a78) != (prev.size=0x00000000))
---------------------------------------
zend_mm_heap corrupted
Segmentation fault
First problem occured in php_mysql.c(316) in function _close_mysql_link on
line "efree(link);". Second in zend_opcode.c in function destroy_op_array
on line "efree(op_array->vars[i].name);".
If you change hostname or password to wrong, you will see another error:
Warning: mysql_connect(): Unknown MySQL server host 'localhost2' (1) in
/home/user/www/t.php on line 2
[Thu Feb 28 18:09:24 2008] Script: '/home/bsg/www/t.php'
---------------------------------------
/home/user/php/ext/mysql/php_mysql.c(831) : Block 0x097db818 status:
Invalid pointer: ((size=0x00000251) != (next.prev=0x00000000))
---------------------------------------
Could not connect: Unknown MySQL server host 'localhost2' (1)
There is no segmentation fault now. But the problem is. In file
php_mysql.c(831) the line is "efree(mysql);" in function
php_mysql_do_connect.
Reproduce code:
---------------
%
<?php
$link = mysql_connect ('localhost', 'login', 'password');
if (!$link)
die ("Could not connect: ". mysql_error ());
echo "Connected successfully.\n";
mysql_close ($link);
echo "Disconnected successfully.\n";
?>
--
Edit bug report at http://bugs.php.net/?id=44283&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44283&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44283&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44283&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44283&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44283&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44283&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44283&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44283&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44283&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44283&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44283&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44283&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44283&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44283&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44283&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44283&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44283&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44283&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44283&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44283&r=mysqlcfg