Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_21_security.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SQLite3 open_basedir checks
! 3: --SKIPIF--
! 4: <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
! 5: --INI--
! 6: open_basedir=.
! 7: --FILE--
! 8: <?php
! 9: $directory = dirname(__FILE__) . '/';
! 10: $file = uniqid() . '.db';
! 11:
! 12: echo "Within test directory\n";
! 13: $db = new SQLite3($directory . $file);
! 14: var_dump($db);
! 15: var_dump($db->close());
! 16: unlink($directory . $file);
! 17:
! 18: echo "Above test directory\n";
! 19: try {
! 20: $db = new SQLite3('../bad' . $file);
! 21: } catch (Exception $e) {
! 22: echo $e . "\n";
! 23: }
! 24:
! 25: echo "Done\n";
! 26: ?>
! 27: --EXPECTF--
! 28: Within test directory
! 29: object(SQLite3)#%d (0) {
! 30: }
! 31: bool(true)
! 32: Above test directory
! 33:
! 34: Warning: SQLite3::__construct(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %ssqlite3_21_security.php on line %d
! 35: exception 'Exception' with message 'open_basedir prohibits opening %s' in %ssqlite3_21_security.php:%d
! 36: Stack trace:
! 37: #0 %ssqlite3_21_security.php(%d): SQLite3->__construct('%s')
! 38: #1 {main}
! 39: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>