php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65450 PHP 5.3.27 segfaults during shutdown
Submitted: 2013-08-14 15:52 UTC Modified: 2021-04-11 04:22 UTC
From: jakub dot lopuszanski at nasza-klasa dot pl Assigned: cmb (profile)
Status: No Feedback Package: CGI/CLI related
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jakub dot lopuszanski at nasza-klasa dot pl
New email:
PHP Version: OS:

 

 [2013-08-14 15:52 UTC] jakub dot lopuszanski at nasza-klasa dot pl
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-31 10:22 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-03-31 10:22 UTC] cmb@php.net
Is that still an issue for you with any of the actively supported
PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-04-11 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC