Bug #16322: Page stops loading when processing arrays in foreach cycles inside functions

From: Date: Wed, 27 Mar 2002 21:52:27 +0000
Subject: Bug #16322: Page stops loading when processing arrays in foreach cycles inside functions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-3526@lists.php.net to get a copy of this message
From: lsro@mega.ist.utl.pt Operating system: Windows XP PHP version: 4.1.2 PHP Bug Type: Arrays related Bug description: Page stops loading when processing arrays in foreach cycles inside functions First of all, I'm running PHP 4.1.2 as a script with Apache 1.3 on Windows XP Pro. I'm only using gd2 and gettext as modules. To illustrate what is happening to me right now, suppose I got an array $authors from a database, each containing another array with two key-value pairs (aid, author.) Now, in order to print it out, I use: function listArticleAuthors() { global $authors; if ($authors) foreach($authors as $a) echo "<li><a href='author.php?id=" . $a[aid] . "'>" . $a[name] . "</a></li>"; return; } I have three or four other functions somewhat similar to this one, which iterate through other arrays. The arrays are all very small (no more than half a dozen elements each.) Now, there's no problem when I run the code below *outside* the function. There is also no problem when I'm calling only a couple of these functions. But when I call all the functions, or the same function more than once, the PHP process inexplicably goes zombie and the page stops loading. It's only when I kill the process using Task Manager that the page resumes loading as normal. There's no lost output, there is no system slowdown. I don't think I'm pushing it too hard: the PHP process just stays running using very little resources (0% processor, 2 or 3 megs.) Any idea about what could be happening? Cheers and thanks! L. -- Edit bug report at http://bugs.php.net/?id=16322&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16322&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16322&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16322&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16322&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16322&r=support Expected behavior: http://bugs.php.net/fix.php?id=16322&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16322&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16322&r=submittedtwice

« previous php.bugs (#3526) next »