#18313 [Fbk->NoF]: elusive recursion-related crash

From: Date: Wed, 11 Sep 2002 16:36:05 +0000
Subject: #18313 [Fbk->NoF]: elusive recursion-related crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19144@lists.php.net to get a copy of this message
ID: 18313 Updated by: sniper@php.net Reported By: admin@finance-on.net -Status: Feedback +Status: No Feedback Bug Type: Reproducible crash Operating System: linux, 2.4 kernel PHP Version: 4.2.1 New Comment: 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 "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2002-07-12 08:56:06] sander@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. Also, please simplify your sample script. Please strip it down to a 5-10 lines standalone samplescript that reproduces your problem. ------------------------------------------------------------------------ [2002-07-12 08:53:05] admin@finance-on.net the isoCompare, when used on a page, will cause it to show up as "document contains no data" ... on some reloads, whereas sometimes it will be fine, using the same inputs. i have not been able to find anything that could be tweaked to change the frequency of crashes. they seem random. as a temporary measure we have moved to the iterative version. i'm quite worried about whether there is a problem with our setup or is this actually an issue in php 4.2.x -- we have not encountered this problem before, the code used to run fine. ------------------------------------------------------------------------ [2002-07-12 08:49:15] admin@finance-on.net i am sorting an array of strings using uasort($a,'isoCompare'). the user function isoCompare, in its recursive variant, crashes randomly. first, the support function charPower which remaps diacritical chars... this one is ok. function charPower ($ch,$charPowerCaseSensitive=FALSE,$charPowerReverseOrder=FALSE) { $power = 0; $char = ($charPowerCaseSensitive ? $ch : strtoupper($ch)); switch (ord($char)) { case 232: $power = 10*ord(($charPowerCaseSensitive ? "c" : "C") case 200: $power = 10*ord("C")+3; break; case 190: $power = 10*ord(($charPowerCaseSensitive ? "z" : "Z") case 174: $power = 10*ord("Z")+5; break; case 185: $power = 10*ord(($charPowerCaseSensitive ? "s" : "S") case 169: $power = 10*ord("S")+5; break; case 230: $power = 10*ord(($charPowerCaseSensitive ? "c" : "C") case 198: $power = 10*ord("C")+6; break; case 240: $power = 10*ord(($charPowerCaseSensitive ? "d" : "D") case 208: $power = 10*ord("D")+5; break; default: $power = 10*ord($char); } return ($charPowerReverseOrder ? ((-1)*$power) : $power); } ; now the recursive isoCompare... function isoCompare ($s1,$s2) { $len1 = strlen($s1); $len2 = strlen($s2); if ($len1==0 || $len2==0) { $ret = $len1 - $len2; if (!$ret) return 0; else return $ret > 0 ? +1 : -1; } ; $c1 = charPower($s1); $c2 = charPower($s2); $power1 = charPower($c1) ; $power2 = charPower($c2) ; if ($power1==$power2) { $ret = isoCompare(substr($s1,1), substr($s2,1)); return $ret; } else { $ret = $power1-$power2; return $ret > 0 ? +1 : -1; } } the iterative version works fine: function isoCompare ($s1, $s2) { global $isadmin; $i = 0; $ret = 0; while (!$ret) { $len1 = strlen($s1); $len2 = strlen($s2); if ($len1 == 0 && $len2 == 0) $ret = 0; elseif ($len1 == 0) $ret = 1; elseif ($len2 == 0) $ret = -1 ; else { $power1 = charPower(substr($s1,0,1)) ; $power2 = charPower(substr($s2,0,1)) ; if ($power1 > $power2) $ret = 1; elseif ($power2 > $power1) $ret = -1; else { $s1 = substr($s1,1); $s2 = substr($s2,1); } ; } ; } ; // while return $ret; } ; my setup: ./configure \ --with-config-file-path=/usr/local/lib \ --with-zlib \ --with-mysql=/usr/local/mysql \ --with-exec-dir=/usr/local/safe_mode --enable-track-vars=yes \ --enable-magic-quotes=yes --disable-debug \ --with-pdflib \ --with-xml \ --with-sablot=/usr/local/lib \ --with-expat=/usr/local/lib \ --enable-sysvsem \ --enable-sysvshm \ --with-gd \ --with-iconv \ --with-curl=/usr/local/curl \ --with-apxs=/usr/local/apache/bin/apxs ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18313&edit=1

« previous php.bugs (#19144) next »