|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16322 Page stops loading when processing arrays in foreach cycles inside functions
Submitted: 2002-03-27 16:52 UTC Modified: 2002-07-19 01:00 UTC
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:0 (0.0%)
From: lsro at mega dot ist dot utl dot pt Assigned:
Status: No Feedback Package: Arrays related
PHP Version: 4.1.2 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: lsro at mega dot ist dot utl dot pt
New email:
PHP Version: OS:


 [2002-03-27 16:52 UTC] lsro at mega dot ist dot utl dot pt
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>";

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!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-18 04:34 UTC]
Please provide a short, ready-to-run (ie. no external dependencies) so that we can try to reproduce it.

 [2002-07-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC