PHP 4.0 Bug #4763: PHP_PUT_FILENAME is gone?
| From: | lrlait at code916 dot gsfc dot nasa dot gov | Date: | Thu, 01 Jun 2000 18:45:23 +0000 |
| Subject: | PHP 4.0 Bug #4763: PHP_PUT_FILENAME is gone? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-20007@lists.php.net to get a copy of this message | ||
From: lrlait@code916.gsfc.nasa.gov
Operating system: IRIX
PHP version: 4.0 Release Candidate 2
PHP Bug Type: Other
Bug description: PHP_PUT_FILENAME is gone?
The technique described in the PHP manual to handle
file upload requests using the HTTP PUT method does not
seem to work, possibly because the $PHP_PUT_FILENAME
variable mentioned there seems to have disappeared in PHP 4.
According to Chapter 18 in the PHP manual, PHP handles
PUT requests in a way similar to how it handles POST
requests, by stashing the uploaded file into a temporary
file. OK, I've done POST stuff in PHP before; I need
the name of the temporary file. And the manual says that
I can get the name of the temporary file in
$PHP_PUT_FILENAME.
But: (a) I find that $PHP_PUT_FILENAME never seems to
be set to anything
(b) grepping the PHP 4.0.0 source code for
'PHP_PUT_FILENAME' turns up no matches
(c) grepping the PHP 3.0.15 source code for
'PHP_PUT_FILENAME' turns up a match in
functions/post.c
I do see a mention of something called $HTTP_POST_FILES
in the 4.0.0 NEWS file and the source code, but I see no documentation on how to use it, or if it
can be used
for PUT method stuff.
And there is nothing in the TODO file about this either.
Documentation problem? Not-yet-reimplemented feature?
I am running PHP 4.0.0 as a module under Apache 1.3.12,
and I do have a "Script PUT" line in my apache config file.
----------- put.php (dumps to log file) ------------
<script language="php">
if(!isset($PHP_AUTH_USER)) {
Header("WWW-Authenticate: Basic realm=\"Download test\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Cancelled\n";
exit;
} else {
echo "Hello $PHP_AUTH_USER.<P>";
echo "You entered $PHP_AUTH_PW as your password.<P>";
}
$logfile="puttest/log.txt";
$ff = fopen($logfile,"a");
if ( $ff ) {
fwrite($ff,"========= " . date("Y-m-d\TH:i:s") . "=======\n");
fwrite($ff,"REQUEST_METHOD=" . getenv("REQUEST_METHOD") . "\n");
fwrite($ff,"REQUEST_URI=" . getenv("REQUEST_URI") . "\n");
fwrite($ff,"PHP_PUT_FILENAME=" . $PHP_PUT_FILENAME . "\n");
fwrite($ff,"Apache headers=\n");
$apchead = getallheaders();
$apcnames = array_keys($apchead);
foreach ($apcnames as $apcvar) {
fwrite($ff," " . $apcvar . " = " . $apchead[$apcvar] . "\n");
}
fwrite($ff,"HTTP_POST_FILES=\n");
if ( isset($HTTP_POST_FILES) ) {
$postnames = array_keys($HTTP_POST_FILES);
foreach ($postnames as $postvar) {
fwrite($ff," " . $postvar . " = " . $HTTP_POST_FILES[$postvar] .
"\n");
}
}
fwrite($ff,"Env vars=\n");
$envnames = array_keys($HTTP_ENV_VARS);
foreach ($envnames as $envvar) {
fwrite($ff," " . $envvar . " = " . $HTTP_ENV_VARS[$envvar] .
"\n");
}
fwrite($ff,"Server vars=\n");
$srvnames = array_keys($HTTP_SERVER_VARS);
foreach ($srvnames as $srvvar) {
fwrite($ff," " . $srvvar . " = " . $HTTP_SERVER_VARS[$srvvar] .
"\n");
}
if ( isset($HTTP_GET_VARS) ) {
fwrite($ff,"Get vars=\n");
$getnames = array_keys($HTTP_GET_VARS);
foreach ($getnames as $getvar) {
fwrite($ff," " . $getvar . " = " . $HTTP_GET_VARS[$getvar] .
"\n");
}
}
if ( isset($HTTP_POST_VARS) ) {
fwrite($ff,"Post vars=\n");
$getnames = array_keys($HTTP_POST_VARS);
foreach ($getnames as $getvar) {
fwrite($ff," " . $getvar . " = " . $HTTP_POST_VARS[$getvar] .
"\n");
}
}
fwrite($ff,"......... " . date("Y-m-d\TH:i:s") . ".......\n");
fclose($ff);
echo "OK, done\n";
} else {
echo "No log file!\n";
}
</script>
-------------- log.txt (output from put.php )--------------
========= 2000-06-01T13:07:13=======
REQUEST_METHOD=PUT
REQUEST_URI=(expunged)/WRITETEST
PHP_PUT_FILENAME=
Apache headers=
Accept = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Charset = iso-8859-1,*,utf-8
Accept-Encoding = gzip
Accept-Language = en
Connection = Keep-Alive
Content-Length = 1
Host = aeolus.gsfc.nasa.gov:183
Pragma = no-cache
User-Agent = Mozilla/4.7 [en]
HTTP_POST_FILES=
Env vars=
(expunged)
Server vars=
PATH_TRANSLATED = (expunged)/put.php
PHP_SELF = (expunged)/WRITETEST
argv = Array
argc = 0
PHP_AUTH_USER = (expunged)
PHP_AUTH_PW = (expunged)
Get vars=
......... 2000-06-01T13:07:13.......