#43419 [Opn]: Using gzfile() with URL and open_basedir
| From: | jani@php.net | Date: | Tue, 27 Nov 2007 12:58:01 +0000 |
| Subject: | #43419 [Opn]: Using gzfile() with URL and open_basedir | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120127@lists.php.net to get a copy of this message | ||
ID: 43419
Updated by: jani@php.net
Reported By: vinni10 at gmx dot net
Status: Open
-Bug Type: Zlib Related
+Bug Type: Safe Mode/open_basedir
Operating System: Linux (Debian)
PHP Version: 5.2.5
New Comment:
This is more general issue, anything trying to use /tmp causes this.
(there are other reports about this too)
Previous Comments:
------------------------------------------------------------------------
[2007-11-26 20:36:11] vinni10 at gmx dot net
Description:
------------
When you try to read an external file with gzfile() and open_basedir
restriction you will get an warning that /tmp is not in allowed paths.
Reproduce code:
---------------
<?php
$url = "http://url/test.gz";
/** Try to use gzfile() with HTTP and open_basedir **/
$var1 = gzfile($url);
/** Try to use gzfile() with downloaded file and open_basedir **/
$filename = "dwltest.gz";
file_put_contents($filename, file_get_contents($url));
$var2 = gzfile($filename);
unlink($filename);
echo "<pre>";
echo "<b>remote gzfile:</b>\n";
var_dump($var1);
echo "\n\n<b>local gzfile:</b>\n";
var_dump($var2);
echo "</pre>";
?>
Expected result:
----------------
remote gzfile:
array(1) {
[0]=>
string(23) "This is a simple test!"
}
local gzfile:
array(1) {
[0]=>
string(23) "This is a simple test!"
}
Actual result:
--------------
Warning: gzfile() [function.gzfile]: open_basedir restriction in
effect. File(/tmp) is not within the allowed path(s): (/var/www/) in
/var/www/gzfile_test.php on line 8
Warning: gzfile(http://url/test.gz) [function.gzfile]: could not make
seekable - http://url/test.gz in /var/www/gzfile_test.php on line 8
remote gzfile:
bool(false)
local gzfile:
array(1) {
[0]=>
string(23) "This is a simple test!"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43419&edit=1