|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-10-01 09:53 UTC] kevin at netflex dot nl
Description:
------------
if you create an function that calls himself with an pass by ref. variable then as a result PHP crashes.
tested with:
* PHP 5.0.0b2-dev (snapshot: php5-win32-200309251030.zip) on Windows (Apache2 2.0.47 and Windows 2003)
* PHP 4.3.3 on Windows (Apache2 2.0.47 and Windows 2003)
* PHP 4.2.3 on Netware (Apache2 2.0.47 and Netware 6.5)
In the web browser appears the page: "can't find server"
and in the log files there is no information about the error/crash
Reproduce code:
---------------
crash($test = 0);
function crash(&$test) {
if ($test < 10)
crash($test);
$test++;
}
Expected result:
----------------
the variable test with an value of (int)10
Actual result:
--------------
with PHP4 on Windows only php crashes and with PHP5 on Windows and PHP4 on Netware both php and apache2 crashes.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 14:00:01 2025 UTC |
function crash(&$test) { if ($test < 10) crash($test); $test++; } There's no chance $test is incremented. So no matter how the variable is passed to the function, it will definitely go into an infinite loop and end up eating up all the stack area which really causes segmentation fault.script to crash the server: crash(); function crash() { crash(); } tested with: * PHP 5.0.0b2-dev (snapshot: php5-win32-200309251030.zip) on Windows (Apache2 2.0.47 and Windows 2003) * PHP 4.3.3 on Windows (Apache2 2.0.47 and Windows 2003) * PHP 4.2.3 on Netware (Apache2 2.0.47 and Netware 6.5)