summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
authorRicardo Melo <rjsmelo@gmail.com>2017-08-25 00:12:36 +0100
committerRicardo Melo <rjsmelo@gmail.com>2017-08-25 00:12:36 +0100
commit8fb5bac6530c7456f88985dc10c848b7ed919bfb (patch)
tree4fc7a6ef768c980603891d1420b91df4db7e420b /ext/readline
parentb1a8dcc001cdd44afc4529b01ac15a2c6400cbd6 (diff)
downloadphp-git-8fb5bac6530c7456f88985dc10c848b7ed919bfb.tar.gz
Test that readline respects open_basedir
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/tests/readline_read_history_open_basedir_001.phpt17
-rw-r--r--ext/readline/tests/readline_write_history_open_basedir_001.phpt17
2 files changed, 34 insertions, 0 deletions
diff --git a/ext/readline/tests/readline_read_history_open_basedir_001.phpt b/ext/readline/tests/readline_read_history_open_basedir_001.phpt
new file mode 100644
index 0000000000..6b8ecce3a9
--- /dev/null
+++ b/ext/readline/tests/readline_read_history_open_basedir_001.phpt
@@ -0,0 +1,17 @@
+--TEST--
+readline_read_history(): Test that open_basedir is respected
+--SKIPIF--
+<?php if (!extension_loaded("readline") || !function_exists('readline_read_history')) die("skip"); ?>
+--INI--
+open_basedir=/tmp/some-sandbox
+--FILE--
+<?php
+
+$name = '/tmp/out-of-sandbox';
+
+var_dump(readline_read_history($name));
+
+?>
+--EXPECTF--
+Warning: readline_read_history(): open_basedir restriction in effect. File(/tmp/out-of-sandbox) is not within the allowed path(s): (/tmp/some-sandbox) in %s on line %d
+bool(false) \ No newline at end of file
diff --git a/ext/readline/tests/readline_write_history_open_basedir_001.phpt b/ext/readline/tests/readline_write_history_open_basedir_001.phpt
new file mode 100644
index 0000000000..bd7880bb9b
--- /dev/null
+++ b/ext/readline/tests/readline_write_history_open_basedir_001.phpt
@@ -0,0 +1,17 @@
+--TEST--
+readline_write_history(): Test that open_basedir is respected
+--SKIPIF--
+<?php if (!extension_loaded("readline") || !function_exists('readline_write_history')) die("skip"); ?>
+--INI--
+open_basedir=/tmp/some-sandbox
+--FILE--
+<?php
+
+$name = '/tmp/out-of-sandbox';
+
+var_dump(readline_write_history($name));
+
+?>
+--EXPECTF--
+Warning: readline_write_history(): open_basedir restriction in effect. File(/tmp/out-of-sandbox) is not within the allowed path(s): (/tmp/some-sandbox) in %s on line %d
+bool(false) \ No newline at end of file