Bug #65450 [Opn->Fbk]: PHP 5.3.27 segfaults during shutdown

From: Date: Wed, 31 Mar 2021 10:22:29 +0000
Subject: Bug #65450 [Opn->Fbk]: PHP 5.3.27 segfaults during shutdown
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233083@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65450&edit=1

 ID:                 65450
 Updated by:         cmb@php.net
 Reported by:        jakub dot lopuszanski at nasza-klasa dot pl
 Summary:            PHP 5.3.27 segfaults during shutdown
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            CGI/CLI related
 Operating System:   linux
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Is that still an issue for you with any of the actively supported
PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>


Previous Comments:
------------------------------------------------------------------------
[2013-08-14 15:52:27] 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



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=65450&edit=1


Thread (3 messages)

« previous php.bugs (#233083) next »