summaryrefslogtreecommitdiff
path: root/tests/basic
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
committerSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
commitcd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (patch)
tree1315c623bb7d9dfa8d366fa9cd2c6834ceeb5da5 /tests/basic
parent9ea47aab740772adf0c69d8c94b208a464e599ea (diff)
downloadphp-upstream/5.2.9.dfsg.1.tar.gz
Imported Upstream version 5.2.9.dfsg.1upstream/5.2.9.dfsg.1
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/021.phpt2
-rw-r--r--tests/basic/bug20539.phpt4
-rw-r--r--tests/basic/bug46313-win.phpt62
-rw-r--r--tests/basic/bug46313.phpt62
-rw-r--r--tests/basic/bug46759.phpt21
5 files changed, 151 insertions, 0 deletions
diff --git a/tests/basic/021.phpt b/tests/basic/021.phpt
index d8f7c1c0e..3010a1b62 100644
--- a/tests/basic/021.phpt
+++ b/tests/basic/021.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #37276 (problems witch $_POST array)
+--INI--
+file_upload=1
--SKIPIF--
<?php if (php_sapi_name()=='cli') die('skip'); ?>
--POST_RAW--
diff --git a/tests/basic/bug20539.phpt b/tests/basic/bug20539.phpt
index 372285bfa..813e129c4 100644
--- a/tests/basic/bug20539.phpt
+++ b/tests/basic/bug20539.phpt
@@ -1,11 +1,15 @@
--TEST--
Bug #20539 (PHP CLI Segmentation Fault)
+--SKIPIF--
+<?php if (!extension_loaded("session")) die("skip session extension not available"); ?>
--INI--
session.auto_start=1
session.save_handler=files
+session.save_path=./tests/basic/
--FILE--
<?php
print "good :)\n";
+ unlink(dirname(__FILE__) . '/sess_' . session_id());
?>
--EXPECT--
good :)
diff --git a/tests/basic/bug46313-win.phpt b/tests/basic/bug46313-win.phpt
new file mode 100644
index 000000000..276efe196
--- /dev/null
+++ b/tests/basic/bug46313-win.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Bug #46313 (Magic quotes broke $_FILES)
+--SKIPIF--
+<?php if(substr(PHP_OS, 0, 3) != "WIN") die("skip Windows-only test"); ?>
+--INI--
+magic_quotes_gpc=1
+file_uploads=1
+register_globals=1
+--POST_RAW--
+Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="o1'file"; filename="o1'file.png"
+Content-Type: text/plain-file1
+
+1
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="o2'file"; filename="o2'file2.txt"
+Content-Type: text/plain-file2
+
+2
+-----------------------------20896060251896012921717172737--
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($GLOBALS["o1\'file_name"]);
+var_dump($GLOBALS["o1\'file_name"] === $_FILES["o1\'file"]["name"]);
+var_dump($GLOBALS["o1\'file"]);
+var_dump($GLOBALS["o1\'file"] === $_FILES["o1\'file"]["tmp_name"]);
+?>
+--EXPECTF--
+array(2) {
+ ["o1\'file"]=>
+ array(5) {
+ ["name"]=>
+ string(12) "o1"
+ ["type"]=>
+ string(16) "text/plain-file1"
+ ["tmp_name"]=>
+ string(14) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(1)
+ }
+ ["o2\'file"]=>
+ array(5) {
+ ["name"]=>
+ string(13) "o2"
+ ["type"]=>
+ string(16) "text/plain-file2"
+ ["tmp_name"]=>
+ string(14) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(1)
+ }
+}
+string(12) "o1"
+bool(true)
+string(%d) "%s"
+bool(true)
diff --git a/tests/basic/bug46313.phpt b/tests/basic/bug46313.phpt
new file mode 100644
index 000000000..275b26796
--- /dev/null
+++ b/tests/basic/bug46313.phpt
@@ -0,0 +1,62 @@
+--TEST--
+Bug #46313 (Magic quotes broke $_FILES)
+--SKIPIF--
+<?php if(substr(PHP_OS, 0, 3) == "WIN") die("skip non-Windows test"); ?>
+--INI--
+magic_quotes_gpc=1
+file_uploads=1
+register_globals=1
+--POST_RAW--
+Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="o1'file"; filename="o1'file.png"
+Content-Type: text/plain-file1
+
+1
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="o2'file"; filename="o2'file2.txt"
+Content-Type: text/plain-file2
+
+2
+-----------------------------20896060251896012921717172737--
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($GLOBALS["o1\'file_name"]);
+var_dump($GLOBALS["o1\'file_name"] === $_FILES["o1\'file"]["name"]);
+var_dump($GLOBALS["o1\'file"]);
+var_dump($GLOBALS["o1\'file"] === $_FILES["o1\'file"]["tmp_name"]);
+?>
+--EXPECTF--
+array(2) {
+ ["o1\'file"]=>
+ array(5) {
+ ["name"]=>
+ string(12) "o1\'file.png"
+ ["type"]=>
+ string(16) "text/plain-file1"
+ ["tmp_name"]=>
+ string(%d) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(1)
+ }
+ ["o2\'file"]=>
+ array(5) {
+ ["name"]=>
+ string(13) "o2\'file2.txt"
+ ["type"]=>
+ string(16) "text/plain-file2"
+ ["tmp_name"]=>
+ string(%d) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(1)
+ }
+}
+string(12) "o1\'file.png"
+bool(true)
+string(%d) "%s"
+bool(true)
diff --git a/tests/basic/bug46759.phpt b/tests/basic/bug46759.phpt
new file mode 100644
index 000000000..fdbd59554
--- /dev/null
+++ b/tests/basic/bug46759.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing magic_quotes_gpc
+--SKIPIF--
+<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
+--INI--
+magic_quotes_gpc=1
+--GET--
+a='&b="&c=\"
+--FILE--
+<?php
+
+foreach ($_GET AS $key => $value)
+{
+ echo $key . ": " . $value . "\n";
+}
+
+?>
+--EXPECT--
+a: \'
+b: \"
+c: \\\"