ID: 24581
User updated by: daniel dot goss at t-systems dot com
Reported By: daniel dot goss at t-systems dot com
Status: Open
Bug Type: Reproducible crash
Operating System: RedHat 8.0, 7.3
PHP Version: 4.3.2
New Comment:
There is a little flaw in the example script. The line
usort($Test, MySort);
should read
usort($Test, "MySort");
but the behaviour is the same.
Previous Comments:
------------------------------------------------------------------------
[2003-07-10 04:26:04] daniel dot goss at t-systems dot com
Description:
------------
The php-engine crashes with a segmentation fault if the function, that
is called by usort calls another recursive function. The recoursion
deepth is less than 10 so there could not be a global stack overflow.
(Tested recursion deepth outside usort min. 8000.)
Reproduce code:
---------------
<?
function MyTest($A, $B, $C, $D, $E, $F, $G)
{
echo "|".$A++."|<BR>";
flush();
if ($A>10)
return 0;
MyTest($A, $B, $C, "", "", "", "");
return 0;
}
function MySort($A, $B)
{
return MyTest(0,$A,$B,"","","","");
}
for ($k=0; $k<100; $k++)
{
$Test[$k]=rand(1,100);
}
echo "BEGIN<BR>";
usort($Test, MySort);
echo "END<BR>";
?>
Expected result:
----------------
The recursion deepth inside the usort function should be min. 100.
Due to the recursive nature of modern sorting algorithms, I understand
that the full recursion deepth, like outside of usort, is not
available. But it should be much more than 10 (on my system)!
Actual result:
--------------
[notice] child pid 8651 exit signal Segmentation fault (11)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24581&edit=1