php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43419 Using gzfile() with URL and open_basedir
Submitted: 2007-11-26 20:36 UTC Modified: 2008-11-21 18:01 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: vinni10 at gmx dot net Assigned:
Status: Open Package: Safe Mode/open_basedir
PHP Version: 5.2.6 OS: Linux (Debian)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vinni10 at gmx dot net
New email:
PHP Version: OS:

 

 [2007-11-26 20:36 UTC] 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!"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-27 12:58 UTC] jani@php.net
This is more general issue, anything trying to use /tmp causes this. (there are other reports about this too)
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Aug 23 04:01:26 2019 UTC