From:             vinni10 at gmx dot net
Operating system: Linux (Debian)
PHP version:      5.2.5
PHP Bug Type:     Zlib Related
Bug description:  Using gzfile() with URL and open_basedir

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 bug report at http://bugs.php.net/?id=43419&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43419&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43419&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43419&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43419&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43419&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43419&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43419&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43419&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43419&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43419&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43419&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43419&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43419&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43419&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43419&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43419&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43419&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43419&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43419&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43419&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43419&r=mysqlcfg

Reply via email to