File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / sqlite3 / tests / sqlite3_21_security.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:02 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
SQLite3 open_basedir checks
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
open_basedir=.
--FILE--
<?php
$directory = dirname(__FILE__) . '/';
$file = uniqid() . '.db';

echo "Within test directory\n";
$db = new SQLite3($directory . $file);
var_dump($db);
var_dump($db->close());
unlink($directory . $file);

echo "Above test directory\n";
try {
	$db = new SQLite3('../bad' . $file);
} catch (Exception $e) {
	echo $e . "\n";
}

echo "Done\n";
?>
--EXPECTF--
Within test directory
object(SQLite3)#%d (0) {
}
bool(true)
Above test directory

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
exception 'Exception' with message 'open_basedir prohibits opening %s' in %ssqlite3_21_security.php:%d
Stack trace:
#0 %ssqlite3_21_security.php(%d): SQLite3->__construct('%s')
#1 {main}
Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>