From: laruence
Operating system:
PHP version: 5.4.0RC3
Package: Built-in web server
Bug Type: Bug
Bug description:Memory leak when access a non-exists file
Description:
------------
report by cjones
if built-in server start with a router:
<?php
if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"]))
return false; // serve the requested resource as-is.
else {
echo "here";
}
?>
then accesss a non-exists file like(a.jpe) will result in mem leak.
Test script:
---------------
<?php
if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"]))
return false; // serve the requested resource as-is.
else {
echo "here";
}
?>
Expected result:
----------------
cjones@mlt:~/w$ php54 -S localhost:8000 routing.php
PHP 5.4.0RC4-dev Development Server started at Mon Dec 19 18:55:25 2011
Listening on localhost:8000
Document root is /home/cjones/public_html
Press Ctrl-C to quit.
[Mon Dec 19 18:55:30 2011] ::1:48358 [200]: /oraclelogo.jpg
[Mon Dec 19 18:55:30 2011] Script:
'/home/cjones/public_html/favicon.ico'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/ext/filter/filter.c(451) :
Freeing 0xB493F0E4 (16 bytes), script=/home/cjones/public_html/favicon.ico
Last leak repeated 19 times
[Mon Dec 19 18:55:30 2011] Script:
'/home/cjones/public_html/favicon.ico'
/home/cjones/phpsrc/php/php-src/branches/PHP_5_4/Zend/zend_execute.h(184) :
Freeing 0xB493F19C (65484 bytes),
script=/home/cjones/public_html/favicon.ico
[Mon Dec 19 18:55:30 2011] Script:
'/home/cjones/public_html/favicon.ico'
.....
--
Edit bug report at https://bugs.php.net/bug.php?id=60591&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60591&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60591&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60591&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60591&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60591&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60591&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60591&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60591&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60591&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60591&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60591&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60591&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60591&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60591&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60591&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60591&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60591&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60591&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60591&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60591&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60591&r=mysqlcfg