From: drews at dynamicwebpages dot de
Operating system: Linux
PHP version: 5.0.3
PHP Bug Type: Reproducible crash
Bug description: Memory Leak with Simplexml leads to segmentation fault
Description:
------------
updating php to 5.0.3 causes php to exit with a segmentation fault(11).
configuring with --enable-debug let it run, but throwing errors into the
apache error_log (see below).
strange: php5.0.0RC3 still works without segfaults and runs happily.
=== config.nice ===
'./configure' \
'--prefix=/srv/php/5.0.3' \
'--with-apxs=/srv/apache/current/bin/apxs' \
'--with-mysql=/srv/mysql/current' \
'--with-imap' \
'--with-imap-ssl' \
'--with-curl' \
'--with-zlib' \
'--with-ftp' \
'--with-gd=/usr/local' \
'--with-png-dir=/usr' \
'--with-zlib-dir=/usr' \
'--with-freetype-dir=/usr' \
'--with-openssl=/srv/openssl/current' \
'--with-bz2' \
'--with-ldap' \
'--with-jpeg-dir=/usr' \
'--enable-versioning' \
'--enable-sockets' \
'--with-mcrypt' \
'--with-mhash' \
'--with-pear=/srv/pear' \
'--with-config-file-path=/etc' \
'--with-tidy' \
=== /config.nice ===
gdb.backtrace does not work out, because enableing debug with php does not
lead to segfault but to memleaks.
Reproduce code:
---------------
if (file_exists($_SESSION['cfgfile'])) {
$CfgObj = simplexml_load_file($_SESSION['cfgfile']);
} else {
die();
}
(not sure, if this causes the segfault, but it is the only
line of code, that makes use of simplexml and could lead to the memleak).
Expected result:
----------------
anything than a segfault ;)
Actual result:
--------------
/usr/local/src/lamp/php-5.0.3/ext/simplexml/simplexml.c(970) : Freeing
0x083EBE14 (2 bytes), script=/var/www/htdocs/DOMAIN/index.php
/usr/local/src/lamp/php-5.0.3/ext/simplexml/simplexml.c(1049) : Freeing
0x083EB33C (16 bytes), script=/var/www/htdocs/DOMAIN/index.php
=== Total 2 memory leaks detected ===
--
Edit bug report at http://bugs.php.net/?id=31373&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31373&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31373&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31373&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31373&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31373&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31373&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31373&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31373&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31373&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31373&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31373&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31373&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31373&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31373&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31373&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31373&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31373&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31373&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31373&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31373&r=mysqlcfg