|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16684 parse error on foreach given array as $_REQUEST['list']
Submitted: 2002-04-18 12:17 UTC Modified: 2002-04-18 12:53 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: bob at mroczka dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.2.0 OS: linux
Private report: No CVE-ID: None
 [2002-04-18 12:17 UTC] bob at mroczka dot com
i would like to iterate over the array named $_REQUEST['list'] like this:

foreach($_REQUEST['list'] as $user) {
	if (strlen($user")>$max) die("too long");
error_log("gettype gives: ". gettype($_REQUEST['list']),0);

when php attempts to run this code I get this parse error in my apache log:

PHP Parse error:  parse error, unexpected '\"' in /var/www/htdocs/tmp.php on line 698

The message I write to the log about the type confirms that the variable is an array.

I am currently using 4.2.0rc4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-18 12:37 UTC]
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit

 [2002-04-18 12:45 UTC] bob at mroczka dot com
This is not a support question.  I know there many ways
to iterate over an array.  I just wanted to alert you to the fact
there is a problem with the foreach construct in its
handling of multi-dimensional arrays.
 [2002-04-18 12:48 UTC] robert at webmotion dot com
> foreach($_REQUEST['list'] as $user) {
>         if (strlen($user")>$max) die("too long");

 [2002-04-18 12:53 UTC]
user error -> bogus
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 27 07:03:36 2021 UTC