summaryrefslogtreecommitdiff
path: root/tests/basic
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/011.phpt7
-rw-r--r--tests/basic/012.phpt7
-rw-r--r--tests/basic/022.phpt1
-rw-r--r--tests/basic/023.phpt2
-rw-r--r--tests/basic/024.phpt1
-rw-r--r--tests/basic/025.phpt1
-rw-r--r--tests/basic/026.phpt1
-rw-r--r--tests/basic/027.phpt1
-rw-r--r--tests/basic/028.phpt105
-rw-r--r--tests/basic/029.phpt51
-rw-r--r--tests/basic/bug46313-win.phpt64
-rw-r--r--tests/basic/bug46313.phpt63
-rw-r--r--tests/basic/bug46759.phpt20
-rw-r--r--tests/basic/bug51709_1.phpt2
-rw-r--r--tests/basic/bug51709_2.phpt2
-rw-r--r--tests/basic/bug54514.phpt12
-rw-r--r--tests/basic/enable_post_data_reading_01.phpt22
-rw-r--r--tests/basic/enable_post_data_reading_02.phpt28
-rw-r--r--tests/basic/enable_post_data_reading_03.phpt23
-rw-r--r--tests/basic/enable_post_data_reading_04.phpt23
-rw-r--r--tests/basic/magic_quotes_gpc.phpt11
-rw-r--r--tests/basic/req44164.phpt17
22 files changed, 289 insertions, 175 deletions
diff --git a/tests/basic/011.phpt b/tests/basic/011.phpt
index 2ec7a6ed12..79256746fe 100644
--- a/tests/basic/011.phpt
+++ b/tests/basic/011.phpt
@@ -6,11 +6,8 @@ register_argc_argv=1
ab+cd+ef+123+test
--FILE--
<?php
-
-if (!ini_get('register_globals')) {
- $argc = $_SERVER['argc'];
- $argv = $_SERVER['argv'];
-}
+$argc = $_SERVER['argc'];
+$argv = $_SERVER['argv'];
for ($i=0; $i<$argc; $i++) {
echo "$i: ".$argv[$i]."\n";
diff --git a/tests/basic/012.phpt b/tests/basic/012.phpt
index 3297853286..5c10c7c222 100644
--- a/tests/basic/012.phpt
+++ b/tests/basic/012.phpt
@@ -9,11 +9,8 @@ variables_order=GPS
ab cd ef 123 test
--FILE--
<?php
-
-if (!ini_get('register_globals')) {
- $argc = $_SERVER['argc'];
- $argv = $_SERVER['argv'];
-}
+$argc = $_SERVER['argc'];
+$argv = $_SERVER['argv'];
for ($i=1; $i<$argc; $i++) {
echo ($i-1).": ".$argv[$i]."\n";
diff --git a/tests/basic/022.phpt b/tests/basic/022.phpt
index 64314ee9ee..0ab70d4be7 100644
--- a/tests/basic/022.phpt
+++ b/tests/basic/022.phpt
@@ -2,6 +2,7 @@
Cookies test#1
--INI--
max_input_vars=1000
+filter.default=unsafe_raw
--COOKIE--
cookie1=val1 ; cookie2=val2%20; cookie3=val 3.; cookie 4= value 4 %3B; cookie1=bogus; %20cookie1=ignore;+cookie1=ignore;cookie1;cookie 5=%20 value; cookie%206=ώζφ;cookie+7=;$cookie.8;cookie-9=1;;;- & % $cookie 10=10
--FILE--
diff --git a/tests/basic/023.phpt b/tests/basic/023.phpt
index ddbcbae005..ca5f1dcfbb 100644
--- a/tests/basic/023.phpt
+++ b/tests/basic/023.phpt
@@ -1,8 +1,8 @@
--TEST--
Cookies test#2
--INI--
-magic_quotes_gpc=0
max_input_vars=1000
+filter.default=unsafe_raw
--COOKIE--
c o o k i e=value; c o o k i e= v a l u e ;;c%20o+o k+i%20e=v;name="value","value",UEhQIQ==;UEhQIQ==foo
--FILE--
diff --git a/tests/basic/024.phpt b/tests/basic/024.phpt
index a28470914b..bf8a206b3a 100644
--- a/tests/basic/024.phpt
+++ b/tests/basic/024.phpt
@@ -1,7 +1,6 @@
--TEST--
Test HTTP_RAW_POST_DATA creation
--INI--
-magic_quotes_gpc=0
always_populate_raw_post_data=1
max_input_vars=1000
--POST--
diff --git a/tests/basic/025.phpt b/tests/basic/025.phpt
index bafcac8091..58191bcd61 100644
--- a/tests/basic/025.phpt
+++ b/tests/basic/025.phpt
@@ -1,7 +1,6 @@
--TEST--
Test HTTP_RAW_POST_DATA with excessive post length
--INI--
-magic_quotes_gpc=0
always_populate_raw_post_data=1
post_max_size=1K
--POST--
diff --git a/tests/basic/026.phpt b/tests/basic/026.phpt
index 957aa1972c..b98a31f430 100644
--- a/tests/basic/026.phpt
+++ b/tests/basic/026.phpt
@@ -1,7 +1,6 @@
--TEST--
Registration of HTTP_RAW_POST_DATA due to unknown content-type
--INI--
-magic_quotes_gpc=0
always_populate_raw_post_data=0
--POST_RAW--
Content-Type: unknown/type
diff --git a/tests/basic/027.phpt b/tests/basic/027.phpt
index db8efbf95a..0528e835a1 100644
--- a/tests/basic/027.phpt
+++ b/tests/basic/027.phpt
@@ -1,7 +1,6 @@
--TEST--
Handling of max_input_nesting_level being reached
--INI--
-magic_quotes_gpc=0
always_populate_raw_post_data=0
display_errors=0
max_input_nesting_level=10
diff --git a/tests/basic/028.phpt b/tests/basic/028.phpt
new file mode 100644
index 0000000000..37d6f21a06
--- /dev/null
+++ b/tests/basic/028.phpt
@@ -0,0 +1,105 @@
+--TEST--
+RFC1867 character quotting
+--INI--
+file_uploads=1
+max_input_vars=1000
+--POST_RAW--
+Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name=name1
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name='name2'
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="name3"
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name=name\4
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name=name\\5
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name=name\'6
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name=name\"7
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name='name\8'
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name='name\\9'
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name='name\'10'
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name='name\"11'
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="name\12"
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="name\\13"
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="name\'14"
+
+testname
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="name\"15"
+
+testname
+-----------------------------20896060251896012921717172737--
+--FILE--
+<?php
+var_dump($_POST);
+?>
+--EXPECT--
+array(15) {
+ ["name1"]=>
+ string(8) "testname"
+ ["name2"]=>
+ string(8) "testname"
+ ["name3"]=>
+ string(8) "testname"
+ ["name\4"]=>
+ string(8) "testname"
+ ["name\5"]=>
+ string(8) "testname"
+ ["name\'6"]=>
+ string(8) "testname"
+ ["name\"7"]=>
+ string(8) "testname"
+ ["name\8"]=>
+ string(8) "testname"
+ ["name\9"]=>
+ string(8) "testname"
+ ["name'10"]=>
+ string(8) "testname"
+ ["name\"11"]=>
+ string(8) "testname"
+ ["name\12"]=>
+ string(8) "testname"
+ ["name\13"]=>
+ string(8) "testname"
+ ["name\'14"]=>
+ string(8) "testname"
+ ["name"15"]=>
+ string(8) "testname"
+}
diff --git a/tests/basic/029.phpt b/tests/basic/029.phpt
new file mode 100644
index 0000000000..6d95c0771d
--- /dev/null
+++ b/tests/basic/029.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Shift_JIS request
+--SKIPIF--
+<?php
+if (!extension_loaded("mbstring")) {
+ die("skip Requires mbstring extension");
+}
+?>
+--INI--
+file_uploads=1
+mbstring.encoding_translation=1
+mbstring.http_input=Shift_JIS
+mbstring.internal_encoding=UTF-8
+--POST_RAW--
+Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="—\Ž\”\"
+
+ƒhƒŒƒ~ƒtƒ@ƒ\
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="pics"; filename="file1.txt"
+Content-Type: text/plain
+
+file1
+
+-----------------------------20896060251896012921717172737--
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($_POST);
+?>
+--EXPECTF--
+array(1) {
+ ["pics"]=>
+ array(5) {
+ ["name"]=>
+ string(9) "file1.txt"
+ ["type"]=>
+ string(10) "text/plain"
+ ["tmp_name"]=>
+ string(%d) "%s"
+ ["error"]=>
+ int(0)
+ ["size"]=>
+ int(6)
+ }
+}
+array(1) {
+ ["δΊˆθš•θƒ½"]=>
+ string(18) "γƒ‰γƒ¬γƒŸγƒ•γ‚‘γ‚½"
+}
diff --git a/tests/basic/bug46313-win.phpt b/tests/basic/bug46313-win.phpt
deleted file mode 100644
index 87786d44ea..0000000000
--- a/tests/basic/bug46313-win.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---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--
-Deprecated: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
-Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
-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
deleted file mode 100644
index 924114161e..0000000000
--- a/tests/basic/bug46313.phpt
+++ /dev/null
@@ -1,63 +0,0 @@
---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
-display_errors=0
---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
deleted file mode 100644
index d35cd534c2..0000000000
--- a/tests/basic/bug46759.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing magic_quotes_gpc
---INI--
-display_errors=0
-magic_quotes_gpc=1
---GET--
-a='&b="&c=\"
---FILE--
-<?php
-
-foreach ($_GET AS $key => $value)
-{
- echo $key . ": " . $value . "\n";
-}
-
-?>
---EXPECT--
-a: \'
-b: \"
-c: \\\"
diff --git a/tests/basic/bug51709_1.phpt b/tests/basic/bug51709_1.phpt
index 8abb92555d..3f2d544e54 100644
--- a/tests/basic/bug51709_1.phpt
+++ b/tests/basic/bug51709_1.phpt
@@ -13,4 +13,4 @@ class foo {
===DONE===
<?php exit(0); ?>
--EXPECTF--
-Parse error: syntax error, unexpected T_FOR, expecting T_STRING in %sbug51709_1.php on line %d
+Parse error: syntax error, unexpected %s, expecting %s in %sbug51709_1.php on line %d
diff --git a/tests/basic/bug51709_2.phpt b/tests/basic/bug51709_2.phpt
index 7763cafe52..bb1f91cc4c 100644
--- a/tests/basic/bug51709_2.phpt
+++ b/tests/basic/bug51709_2.phpt
@@ -13,4 +13,4 @@ class foo {
===DONE===
<?php exit(0); ?>
--EXPECTF--
-Parse error: syntax error, unexpected T_GOTO, expecting T_STRING in %sbug51709_2.php on line %d
+Parse error: syntax error, unexpected %s, expecting %s in %sbug51709_2.php on line %d
diff --git a/tests/basic/bug54514.phpt b/tests/basic/bug54514.phpt
new file mode 100644
index 0000000000..0c5595e3f7
--- /dev/null
+++ b/tests/basic/bug54514.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Req #54514 (Get php binary path during script execution)
+--FILE--
+<?php
+if(realpath(getenv('TEST_PHP_EXECUTABLE')) === realpath(PHP_BINARY)) {
+ echo "done";
+} else {
+ var_dump(getenv('TEST_PHP_EXECUTABLE'));
+ var_dump(PHP_BINARY);
+}
+--EXPECT--
+done
diff --git a/tests/basic/enable_post_data_reading_01.phpt b/tests/basic/enable_post_data_reading_01.phpt
new file mode 100644
index 0000000000..1a0e33f617
--- /dev/null
+++ b/tests/basic/enable_post_data_reading_01.phpt
@@ -0,0 +1,22 @@
+--TEST--
+enable_post_data_reading: basic test
+--INI--
+enable_post_data_reading=0
+--POST_RAW--
+Content-Type: application/x-www-form-urlencoded
+a=1&b=ZYX
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($_POST);
+var_dump($HTTP_RAW_POST_DATA);
+var_dump(file_get_contents("php://input"));
+--EXPECTF--
+array(0) {
+}
+array(0) {
+}
+
+Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+NULL
+string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_02.phpt b/tests/basic/enable_post_data_reading_02.phpt
new file mode 100644
index 0000000000..dc7f6b127a
--- /dev/null
+++ b/tests/basic/enable_post_data_reading_02.phpt
@@ -0,0 +1,28 @@
+--TEST--
+enable_post_data_reading: rfc1867
+--INI--
+enable_post_data_reading=0
+--POST_RAW--
+Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
+-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file1"; filename="file1.txt"
+Content-Type: text/plain-file
+
+1
+-----------------------------20896060251896012921717172737--
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($_POST);
+var_dump(file_get_contents("php://input"));
+--EXPECTF--
+array(0) {
+}
+array(0) {
+}
+string(%d) "-----------------------------20896060251896012921717172737
+Content-Disposition: form-data; name="file1"; filename="file1.txt"
+Content-Type: text/plain-file
+
+1
+-----------------------------20896060251896012921717172737--"
diff --git a/tests/basic/enable_post_data_reading_03.phpt b/tests/basic/enable_post_data_reading_03.phpt
new file mode 100644
index 0000000000..cdabe910ca
--- /dev/null
+++ b/tests/basic/enable_post_data_reading_03.phpt
@@ -0,0 +1,23 @@
+--TEST--
+enable_post_data_reading: always_populate_raw_post_data has no effect (1)
+--INI--
+enable_post_data_reading=0
+always_populate_raw_post_data=1
+--POST_RAW--
+Content-Type: application/x-www-form-urlencoded
+a=1&b=ZYX
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($_POST);
+var_dump($HTTP_RAW_POST_DATA);
+var_dump(file_get_contents("php://input"));
+--EXPECTF--
+array(0) {
+}
+array(0) {
+}
+
+Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+NULL
+string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_04.phpt b/tests/basic/enable_post_data_reading_04.phpt
new file mode 100644
index 0000000000..a1685040bb
--- /dev/null
+++ b/tests/basic/enable_post_data_reading_04.phpt
@@ -0,0 +1,23 @@
+--TEST--
+enable_post_data_reading: always_populate_raw_post_data has no effect (2)
+--INI--
+enable_post_data_reading=0
+always_populate_raw_post_data=1
+--POST_RAW--
+Content-Type: application/unknown
+a=1&b=ZYX
+--FILE--
+<?php
+var_dump($_FILES);
+var_dump($_POST);
+var_dump($HTTP_RAW_POST_DATA);
+var_dump(file_get_contents("php://input"));
+--EXPECTF--
+array(0) {
+}
+array(0) {
+}
+
+Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+NULL
+string(9) "a=1&b=ZYX"
diff --git a/tests/basic/magic_quotes_gpc.phpt b/tests/basic/magic_quotes_gpc.phpt
deleted file mode 100644
index 0be6533b78..0000000000
--- a/tests/basic/magic_quotes_gpc.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Bug #61043 (Regression in magic_quotes_gpc fix for CVE-2012-0831)
---INI--
-error_reporting=E_ALL & ~E_DEPRECATED
-magic_quotes_gpc=On
---FILE--
-<?php
-var_dump(ini_get("magic_quotes_gpc"));
-?>
---EXPECT--
-string(1) "1"
diff --git a/tests/basic/req44164.phpt b/tests/basic/req44164.phpt
new file mode 100644
index 0000000000..d0082861f2
--- /dev/null
+++ b/tests/basic/req44164.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Req #44164 (Handle "Content-Length" HTTP header when zlib.output_compression active)
+--SKIPIF--
+<?php
+if (!function_exists('gzdeflate'))
+ die("skip zlib extension required");
+?>
+--INI--
+zlib.output_compression=On
+--ENV--
+HTTP_ACCEPT_ENCODING=gzip
+--FILE--
+<?php
+header("Content-length: 200");
+echo str_repeat("a", 200);
+--EXPECT--
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa