Skip to content

Commit

Permalink
Update test script
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Nov 21, 2012
1 parent 441bb17 commit 6a9b197
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions tests/037.phpt
@@ -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

0 comments on commit 6a9b197

Please sign in to comment.