From: jakub dot lopuszanski at nasza-klasa dot pl
Operating system: linux
PHP version: Irrelevant
Package: CGI/CLI related
Bug Type: Bug
Bug description:PHP 5.3.27 segfaults during shutdown
Description:
------------
Follwing script outputs
"""
X
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate
72 bytes) in /home/jlopuszanski/test.php on line 8
B
Segmentation fault
"""
on php 5.3.27.
The problem is quite difficult to reproduce, as it greately depends on the
filename, length of arguments etc.
Therefore I run it in a loop with different length of an argument passed to
the
script.
Sometimes uncommenting the line with echo "Y\n"; (even though it is
obviously
unreachable) helps to cause the error.
Sometimes I have to use ~/test.php or ./test.php instead of test.php as a
filename to trigger the Segfault.
Once I find a good combination of filename and arguments, the problem is
persistent and can be reproduced 100% of times for that combination.
Test script:
---------------
cat test.php
<?php
class A{
function __construct(){
register_shutdown_function(array(__CLASS__, 'handle_shutdown'));
echo "X\n";
while(1){
$t[]=new B();
}
// echo "Y\n";
}
static public function handle_shutdown(){
echo "B\n";
$b=new B();
$b=null;
}
}
class B{
}
$a=new A();
?>
for((n=0;n<100;++n));
do
echo $n;
php-5.3.27/bin/php ~/test.php `for((i=0;i<n;++i));do echo -n a;done`;
done
Expected result:
----------------
X
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate
72 bytes) in /home/jlopuszanski/test.php on line 8
B
Actual result:
--------------
X
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate
72 bytes) in /home/jlopuszanski/test.php on line 8
B
Segmentation fault
--
Edit bug report at https://bugs.php.net/bug.php?id=65450&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=65450&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=65450&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=65450&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65450&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65450&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65450&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65450&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65450&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65450&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65450&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65450&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65450&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65450&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65450&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65450&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65450&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65450&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65450&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65450&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65450&r=mysqlcfg