From 4a46e089f7d884c81052b5c76a03d2f35a689235 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Sat, 17 Oct 2009 22:47:30 +0000 Subject: [PATCH] test_realpath.php : simpler testing of realpath() and $_SERVER --- min_unit_tests/test_realpath.php | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 min_unit_tests/test_realpath.php diff --git a/min_unit_tests/test_realpath.php b/min_unit_tests/test_realpath.php new file mode 100644 index 0000000..9ed6666 --- /dev/null +++ b/min_unit_tests/test_realpath.php @@ -0,0 +1,64 @@ + $_SERVER["DOCUMENT_ROOT"] + ,'__FILE__' => __FILE__ + ,'$_SERVER["SCRIPT_FILENAME"]' => $_SERVER["SCRIPT_FILENAME"] +); + +function e($txt) { + if (is_string($txt)) { + return htmlspecialchars($txt, ENT_QUOTES, 'UTF-8'); + } else { + return '' . htmlspecialchars(var_export($txt, true), ENT_QUOTES, 'UTF-8') . ''; + } +} +function rp() { + if (! isset($_POST['rp']) || ! is_string($_POST['rp'])) { + return ''; + } + return get_magic_quotes_gpc() + ? stripslashes($_POST['rp']) + : $_POST['rp']; +} + +header('Content-Type: text/html; charset=utf-8'); + +?> + +Test of $_SERVER and realpath() + + + +

Test of $_SERVER and realpath()

+ + $value): ?> +

+ + + +
value
realpath(value)
+ +

$_SERVER['REQUEST_URI']

+ + +
value
+ +

Test realpath()

+ + +

+

+ +
= 
+ +
+ + \ No newline at end of file