php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24565 cannot read array elements recived via $_REQUEST
Submitted: 2003-07-09 11:16 UTC Modified: 2003-07-22 11:11 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: nightcat at poczta dot onet dot pl Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.0b2-dev OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nightcat at poczta dot onet dot pl
New email:
PHP Version: OS:

 

 [2003-07-09 11:16 UTC] nightcat at poczta dot onet dot pl
Description:
------------
In PHP5 yesterdays snapshot i'm unable to get array element created by POST/GET method.

Reproduce code:
---------------
<?
if (isset($_REQUEST['arr1'])) {
  print_r($_REQUEST['arr1']); // displays key and value.
  print('test1: '.$_REQUEST['arr1'][0]); // error
  print_r(array_keys($_REQUEST['arr1'])); // returns one index: '0'
}
?>
<html>
<head>
<title> TestCase </title>
</head>
<body>
<form method=post action="">
test1: <input type="checkbox" name="arr1[0]" value="1" /><br />
<input type="submit" />
</form>
</body>
</html>

Expected result:
----------------
test1: 1

Actual result:
--------------
Notice: Undefined offset: 2 in D:\server\www\test\php5\index.phtml on line 4
test1: 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-09 15:05 UTC] tingle at virtuanews dot co dot uk
Confirmed using Apache 2.0.46, Windows XP SP1 and the latest snapshot (php5-win32-200307091830.zip)

Identical problem as stated

print_r() gives the expected output with the expected keys and values, however, trying to reference the key within the code results in it not being set
 [2003-07-09 16:00 UTC] sniper@php.net
Reproduced with latest PHP 5 CVS. Works fine with PHP 4.3.3RC2-dev.

 [2003-07-21 22:29 UTC] vma1 at abv dot bg
One more thing - setting "register_long_arrays = On" in php.ini makes the problem go away. But its bad because of the performance hit.
 [2003-07-22 05:14 UTC] Nico dot Laus dot 2001 at gmx dot de
look at
http://bugs.php.net/bug.php?id=24652
-> same Bug

btw: I have set "register_long_arrays = On" and it does not chang anything - same problems as before!
 [2003-07-22 10:01 UTC] vma1 at abv dot bg
> btw: I have set "register_long_arrays = On" and it does
> not chang anything - same problems as before!
Yes it was my mistake. Actually this problem stays even after long arrays are enabled
 [2003-07-22 11:11 UTC] zeev@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC