#31478 [NEW]: SegFault/Memory Leak
| From: | the_deppchef at hotmail dot com | Date: | Mon, 10 Jan 2005 21:55:26 +0000 |
| Subject: | #31478 [NEW]: SegFault/Memory Leak | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-71772@lists.php.net to get a copy of this message | ||
From: the_deppchef at hotmail dot com
Operating system: Linux 2.4.27 (Debian)
PHP version: 5CVS-2005-01-10 (dev)
PHP Bug Type: Reproducible crash
Bug description: SegFault/Memory Leak
Description:
------------
Well, reading the manual about empty() you should think it checks whether
the given variable is set before it checks whether it is empty.
(Given example there:
if (empty($var)) {
echo '$var is either 0, empty, or not set at all';
})
However, when $var really is not set, i get a Memory Leak (in a big
script). I reduced the script to the code below and now even get a
Segmentation fault.
Reproduce code:
---------------
<?php
if(empty($foo)){
echo 'empty';
}else{
echo 'not empty';
}
?>
Expected result:
----------------
Echoing "empty" and nothing else.
Actual result:
--------------
Echoing "empty"
Valgrind says: http://tdc.medieval-wars.de/valgrind.txt.pid27963
Probably most important:
==27963== Process terminating with default action of signal 11 (SIGSEGV)
==27963== Access not within mapped region at address 0xF45
==27963== at 0x81EDD17: zend_execute_scripts
(/home/necmon/php5-200501101930/Zend/zend.c:1059)
==27963== by 0x819E50D: php_execute_script
(/home/necmon/php5-200501101930/main/main.c:1636)
==27963== by 0x8277DAE: main
(/home/necmon/php5-200501101930/sapi/cli/php_cli.c:944)
(Note: this does NOT only happen with the cli version!)
--
Edit bug report at http://bugs.php.net/?id=31478&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31478&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31478&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31478&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31478&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31478&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31478&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31478&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31478&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31478&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31478&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31478&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31478&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31478&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31478&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31478&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31478&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31478&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31478&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31478&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31478&r=mysqlcfg