Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,42 @@ | ||
--TEST-- | ||
Check for Yaf_Loader and open_basedir | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("yaf")) print "skip"; ?> | ||
<?php | ||
if (!extension_loaded("yaf")) { | ||
die("skip"); | ||
} | ||
if (version_compare(PHP_VERSION, "5.3", "lt")) { | ||
die("skip open_basedir only can be tightened as of 5.3.0"); | ||
} | ||
?> | ||
--INI-- | ||
open_basedir=. | ||
yaf.lowcase_path=0 | ||
--FILE-- | ||
<?php | ||
$loader = Yaf_Loader::getInstance("/tmp"); | ||
$loader->import('/tmp/no_exists_037.php'); | ||
$loader->autoload("Foo_Bar307"); | ||
$dir = __DIR__; | ||
$odir = $dir . "/foo"; | ||
file_put_contents($dir . "/Dummy.php", ""); | ||
|
||
ini_set("open_basedir", $odir); | ||
$loader = Yaf_Loader::getInstance($dir); | ||
$loader->import($dir . "/Dummy.php"); | ||
$loader->autoload("Dummy"); | ||
?> | ||
--CLEAN-- | ||
<?php | ||
unlink(__DIR__ . "/Dummy.php"); | ||
?> | ||
--EXPECTF-- | ||
Warning: Yaf_Loader::autoload(): Failed opening script %sBar307.php: No such file or directory in %s037.php on line %d | ||
Warning: Yaf_Loader::import(): open_basedir restriction in effect. File(%sDummy.php) is not within the allowed path(s): (%sfoo) in %s037.php on line %d | ||
|
||
Warning: Yaf_Loader::import(%sDummy.php): failed to open stream: Operation not permitted in %s037.php on line %d | ||
|
||
Warning: Yaf_Loader::import(): Failed opening '%sDummy.php' for inclusion (include_path='%s') in %s037.php on line %d | ||
|
||
Warning: Yaf_Loader::autoload(): open_basedir restriction in effect. File(%sDummy.php) is not within the allowed path(s): (%sfoo) in %s037.php on line %d | ||
|
||
Warning: Yaf_Loader::autoload(%sDummy.php): failed to open stream: Operation not permitted in %s037.php on line %d | ||
|
||
Warning: Yaf_Loader::autoload(): Failed opening '%sDummy.php' for inclusion (include_path='%s') in %s037.php on line %d | ||
|
||
Warning: Yaf_Loader::autoload(): Failed opening script %sDummy.php: Operation not permitted in %s037.php on line %d |