php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19848 Wrong $_REQUEST values ($_FILES appearance is wacky)
Submitted: 2002-10-10 10:10 UTC Modified: 2002-11-15 13:38 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: capelli at in2p3 dot fr Assigned: sterling (profile)
Status: Closed Package: HTTP related
PHP Version: 4.2.3,4,3.0-dev OS: *any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: capelli at in2p3 dot fr
New email:
PHP Version: OS:

 

 [2002-10-10 10:10 UTC] capelli at in2p3 dot fr
In this particular form case:

<FORM METHOD=POST ACTION="test2.php" enctype="multipart/form-data">
<INPUT TYPE="text" NAME="toto[a]"><BR>
<INPUT TYPE="text" NAME="toto[b]"><BR>
<INPUT TYPE="file" NAME="toto[c]"><BR>
<INPUT TYPE="submit">
</FORM>

we expect in $_REQUEST:
Array
(
    [toto] => Array
        (
            [a] => a
            [b] => b
            [c] => Array
             (
                  [name] => apple.jpg
                  [type] => image/pjpeg
                  [tmp_name] => C:\TEMP\PHPUPLOAD\php233.tmp
                  [error] => 0
                  [size] => 24777
             )
        )
)

and unfortunately we get:
Array
(
    [toto] => Array
        (
            [name] => Array
                (
                    [c] => apple.jpg
                )
            [type] => Array
                (
                    [c] => image/pjpeg
                )
            [tmp_name] => Array
                (
                    [c] => C:\TEMP\PHPUPLOAD\php234.tmp
                )
            [error] => Array
                (
                    [c] => 0
                )
            [size] => Array
                (
                    [c] => 24777
                )
        )
)

.......




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-10 10:27 UTC] msopacua@php.net
I think a dupe of
http://bugs.php.net/17958

as $_REQUEST is a combination of $_GET, $_POST, $_COOKIE.

Are you using Apache 2 and can you verify what's posted in there?
 [2002-10-10 10:27 UTC] msopacua@php.net
I think a dupe of
http://bugs.php.net/17958

as $_REQUEST is a combination of $_GET, $_POST, $_COOKIE.

Are you using Apache 2 and can you verify what's posted in there?
 [2002-10-10 10:28 UTC] msopacua@php.net
grr, need a new trackball
 [2002-10-10 10:43 UTC] capelli at in2p3 dot fr
On Windows, I used a 4.2.1 PHP version and 2.0.39 Apache version.
On SunOS, a 4.2.3 PHP version and 1.3.26 Apache version are used.

The results are identical

The $_POST variable is uncomplete:
Array
(
    [toto] => Array
        (
            [a] => a
            [b] => b
            [c] => C:\TEMP\PHPUPLOAD\php23F.tmp
        )
)
 [2002-10-10 17:59 UTC] sniper@php.net
Actually $_REQUEST should contain $_FILES too (according to docs) but it doesn't seem to work, not in HEAD either.

And in this case, it propably is pretty hard to get work 'correctly' since the $_FILES array structure is what it is.

 [2002-10-15 15:21 UTC] ich at ersiees dot com
BTW, 17958 is "no feedback".
Well, that's pretty untrue ...
 [2002-10-16 06:29 UTC] ferdhie2k at yahoo dot com
Also got the same cases.
<form method="post" action="test.php">
<input type="checkbox" name="server[]" value="ASP">
<input type="checkbox" name="server[]" value="C">
<input type="checkbox" name="server[]" value="COLDFUSION">
<input type="checkbox" name="server[]" value="JAVA">
<input type="checkbox" name="server[]" value="PERL">
<input type="checkbox" name="server[]" value="PHP">
</form>

print_r($_POST['server']);

it comes out:
---------------
Array 
( 
[0] => ASP 
[1] => C# 
[2] => FUSION 
[3] => 
[4] => 
[5] => PHP 
) 

Apache/1.3.26, Win98
 [2002-10-20 22:14 UTC] imajes@php.net
Sterling Hughes is working on this issue, according to posts to php-dev.

 [2002-10-20 22:17 UTC] sniper@php.net
The 'voting' on php-dev was in favour for removing the $_FILES from $_REQUEST..as it doesn't make much sense
to have them there. Just FYI. :)

--Jani

 [2002-10-24 18:42 UTC] mzeitler at accrisoft dot com
This test form strips 3 characters from the posted variable:

<FORM METHOD=POST ACTION="">
<INPUT TYPE="text" name="foo[a]" VALUE="<?=$foo['a']?>">
<INPUT TYPE="submit">
</FORM>

2 dimensional array - this test form strips 8 characters from the posted variable:

<FORM METHOD=POST ACTION="">
<INPUT TYPE="text" name="foo[a][b]" VALUE="<?=$foo['a']['b']?>">
<INPUT TYPE="submit">
</FORM>

For every dimension added to the array, another 4 characters are scripted from the beginning of the posted variable.  Works on PHP version less than 4.2.2 and earlier.
 [2002-10-27 20:47 UTC] sterling@php.net
Fixed in CVS... $_FILES is no longer present in $_REQUEST...
 [2002-11-15 07:44 UTC] spamlanzz at graffiti dot net
not sure if this is important, but import_request_variables imports the wrong thing.

html:
  <input name="d[text]" value="hello">
  <input type="file" name="d[file]">

code:
  import_request_variables("GP", "__");

result:

$__d = array (
  'name' => array ( 'file' => '' ),
  'type' => array ( 'file' => '' ),
  'tmp_name' => array ( 'file' => '' ),
  'error' => array ( 'file' => 4 ),
  'size' => array ( 'file' => 0 )
)
 [2002-11-15 12:45 UTC] philip@php.net
Until import_request_variables() behavior is discussed in php-dev this should remain open.  IMHO $_REQUEST and import_request_variables() should behave the same way as to remain consistent.  As of PHP 4.3.0 $_FILES was only removed from $_REQUEST.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC