php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20725 $_REQUEST not populated when there is no tmp dir or upload_tmp_dir not writable
Submitted: 2002-11-29 08:12 UTC Modified: 2002-12-06 18:48 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: msopacua@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.0-dev2002-12-05 OS: BSD/OS 4.2
Private report: No CVE-ID:
 [2002-11-29 08:12 UTC] msopacua@php.net
Stumbled upon this, in a chrooted environment.

No php.ini (so default settings). No /tmp and /var/tmp or make upload_tmp_dir not writeable for the webserver.

display_errors On
error_reporting 'no value' (E_ALL ^ E_NOTICE)

$_REQUEST/_POST are not populated.

Only when setting display_startup_errors to 'On', one gets a clue, what is going on.

Example:
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="this_var_should_be_set" value="foo" />
<input type="file" name="userfile" />
<input type="submit" value="test" />
</form>
<pre>
<?php
var_dump($_REQUEST, $_POST);
?>
</pre>

output:
array(0){
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-05 01:08 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

I've been unable to replicate this problem using latest CVS of  4.3.0-dev/4.4.0-dev. Please try a later version and report back, there is nothing in the code to cause the behaviour you've described.
 [2002-12-05 01:38 UTC] philip@php.net
I can't replicate either, and I set upload_tmp_dir to something that doesn't exist.  But anyway can you separate the dump of $_POST and $_REQUEST so we know which one at least exists? And can you explain what display_startup_errors affect is on this exactly?  And does it matter if upload_tmp_dir is set?  Don't see why it would.  Anyway, please do more tests and try to see if you can get it to work :)
 [2002-12-05 03:09 UTC] msopacua@php.net
philip: $_REQUEST and $_POST both don't exist. display_startup_errors gives you a warning "File upload error - unable to create a temporary file" so you actually have to upload something for this bug to trigger.
If upload_tmp_dir isn't set, it tries to use /var/tmp, /tmp or anything similar.

Using latest 4.3 branch I can't reproduce it either, but this is another server. The server where I discovered this bug, is in production, so I won't be able to test it until some odd hours during the weekend.
 [2002-12-05 03:31 UTC] philip@php.net
You have:

<?php
var_dump($_REQUEST, $_POST);
?>
</pre>

output:
array(0){
}

This suggests one exists, it's just empty.  Which one I wonder...
 [2002-12-05 03:35 UTC] msopacua@php.net
cut and paste error on my part - sorry bout that. The output should be array{0} twice.
 [2002-12-06 10:30 UTC] msopacua@php.net
Thanx to bug #20860, I found why my test didn't work. New testcase:
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"
enctype="multipart/form-data">
<input type="hidden" name="this_var_should_be_set" value="foo" />
<input type="file" name="userfile" />
<input type="hidden" name="this_other_var_should_be_set" value="bar" />
<input type="submit" value="test" />
</form>
<pre>
<?php
var_dump($_REQUEST, $_POST);
?>
</pre>

Output:
array(2) {
  ["this_var_should_be_set"]=>
  string(3) "foo"
  ["ApacheSessionId"]=>
  string(35) "anonymized"
}
array(1) {
  ["this_var_should_be_set"]=>
  string(3) "foo"
}

The ApacheSessionId in there is a cookie, via mod_user_track, but is not relevant to the bug.

Cvs build:
PHP 4.3.0-dev (cli) (built: Dec  5 2002 09:30:48)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies

 [2002-12-06 18:48 UTC] iliaa@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-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 22:02:05 2014 UTC