summaryrefslogtreecommitdiff
path: root/sapi/tests
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /sapi/tests
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'sapi/tests')
-rw-r--r--sapi/tests/test001.phpt16
-rw-r--r--sapi/tests/test002.phpt22
-rw-r--r--sapi/tests/test003.phpt21
-rw-r--r--sapi/tests/test004.phpt26
-rw-r--r--sapi/tests/test005.phpt27
-rw-r--r--sapi/tests/test006.phpt73
-rw-r--r--sapi/tests/test007.phpt46
7 files changed, 231 insertions, 0 deletions
diff --git a/sapi/tests/test001.phpt b/sapi/tests/test001.phpt
new file mode 100644
index 0000000..a964393
--- /dev/null
+++ b/sapi/tests/test001.phpt
@@ -0,0 +1,16 @@
+--TEST--
+IIS style CGI missing SCRIPT_FILENAME
+--DESCRIPTION--
+This would be similar to what IIS produces for a simple query.
+--ENV--
+return <<<END
+PATH_TRANSLATED=$filename
+PATH_INFO=$scriptname
+SCRIPT_NAME=$scriptname
+END;
+--FILE--
+<?php
+ echo "HELLO";
+?>
+--EXPECT--
+HELLO \ No newline at end of file
diff --git a/sapi/tests/test002.phpt b/sapi/tests/test002.phpt
new file mode 100644
index 0000000..42ade3d
--- /dev/null
+++ b/sapi/tests/test002.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Apache style CGI
+--DESCRIPTION--
+Apache likes to set SCRIPT_FILENAME to the php executable
+if you use ScriptAlias configurations, and the proper
+path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked,
+but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias
+of the executable.
+--ENV--
+return <<<END
+REDIRECT_URL=$scriptname
+PATH_TRANSLATED=$filename
+PATH_INFO=$scriptname
+SCRIPT_NAME=/scriptalias/php
+SCRIPT_FILENAME=$this->conf['TEST_PHP_EXECUTABLE']
+END;
+--FILE--
+<?php
+ echo "HELLO";
+?>
+--EXPECT--
+HELLO \ No newline at end of file
diff --git a/sapi/tests/test003.phpt b/sapi/tests/test003.phpt
new file mode 100644
index 0000000..5cabe66
--- /dev/null
+++ b/sapi/tests/test003.phpt
@@ -0,0 +1,21 @@
+--TEST--
+IIS style CGI missing SCRIPT_FILENAME, has PATH_INFO
+--DESCRIPTION--
+This would be similar to what IIS produces for a simple query
+that also has PATH_INFO.
+--REQUEST--
+return <<<END
+PATH_INFO=/path/info
+END;
+--ENV--
+return <<<END
+PATH_TRANSLATED=/path/bla
+PATH_INFO=/path/info
+SCRIPT_NAME=path
+END;
+--FILE--
+<?php
+ echo $_SERVER['PATH_INFO'];
+?>
+--EXPECT--
+/path/info \ No newline at end of file
diff --git a/sapi/tests/test004.phpt b/sapi/tests/test004.phpt
new file mode 100644
index 0000000..ef43774
--- /dev/null
+++ b/sapi/tests/test004.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Apache style CGI with PATH_INFO
+--DESCRIPTION--
+Apache likes to set SCRIPT_FILENAME to the php executable
+if you use ScriptAlias configurations, and the proper
+path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked,
+but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias
+of the executable.
+--REQUEST--
+return <<<END
+PATH_INFO=/path/info
+END;
+--ENV--
+return <<<END
+REDIRECT_URL=/path
+PATH_TRANSLATED=/path/info/fpp
+PATH_INFO=/path/info
+SCRIPT_NAME=/scriptalias/php
+SCRIPT_FILENAME=$this->conf['TEST_PHP_EXECUTABLE']
+END;
+--FILE--
+<?php
+ echo $_SERVER['PATH_INFO'];
+?>
+--EXPECT--
+/path/info \ No newline at end of file
diff --git a/sapi/tests/test005.phpt b/sapi/tests/test005.phpt
new file mode 100644
index 0000000..7415b66
--- /dev/null
+++ b/sapi/tests/test005.phpt
@@ -0,0 +1,27 @@
+--TEST--
+QUERY_STRING Security Bug
+--DESCRIPTION--
+This bug was present in PHP 4.3.0 only.
+A failure should print HELLO.
+--REQUEST--
+return <<<END
+SCRIPT_NAME=/nothing.php
+QUERY_STRING=$filename
+END;
+--ENV--
+return <<<END
+REDIRECT_URL=$scriptname
+PATH_TRANSLATED=c:\apache\1.3.27\htdocs\nothing.php
+QUERY_STRING=$filename
+PATH_INFO=/nothing.php
+SCRIPT_NAME=/phpexe/php.exe/nothing.php
+SCRIPT_FILENAME=c:\apache\1.3.27\htdocs\nothing.php
+END;
+--FILE--
+<?php
+ echo "HELLO";
+?>
+--EXPECTHEADERS--
+Status: 404
+--EXPECT--
+No input file specified. \ No newline at end of file
diff --git a/sapi/tests/test006.phpt b/sapi/tests/test006.phpt
new file mode 100644
index 0000000..45e3781
--- /dev/null
+++ b/sapi/tests/test006.phpt
@@ -0,0 +1,73 @@
+--TEST--
+Multipart Form POST Data
+--HEADERS--
+return <<<END
+Content-Type=multipart/form-data; boundary=---------------------------240723202011929
+Content-Length=862
+END;
+--ENV--
+return <<<END
+CONTENT_TYPE=multipart/form-data; boundary=---------------------------240723202011929
+CONTENT_LENGTH=862
+END;
+--POST--
+-----------------------------240723202011929
+Content-Disposition: form-data; name="entry"
+
+entry box
+-----------------------------240723202011929
+Content-Disposition: form-data; name="password"
+
+password box
+-----------------------------240723202011929
+Content-Disposition: form-data; name="radio1"
+
+test 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="checkbox1"
+
+test 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="choices"
+
+Choice 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="choices"
+
+Choice 2
+-----------------------------240723202011929
+Content-Disposition: form-data; name="file"; filename="info.php"
+Content-Type: application/octet-stream
+
+<?php
+phpinfo();
+?>
+-----------------------------240723202011929--
+
+--FILE--
+<?php
+error_reporting(0);
+print_r($_POST);
+print_r($_FILES);
+?>
+--EXPECTF--
+Array
+(
+ [entry] => entry box
+ [password] => password box
+ [radio1] => test 1
+ [checkbox1] => test 1
+ [choices] => Choice 2
+)
+Array
+(
+ [file] => Array
+ (
+ [name] => info.php
+ [type] => application/octet-stream
+ [tmp_name] => %s
+ [error] => 0
+ [size] => 21
+ )
+
+)
diff --git a/sapi/tests/test007.phpt b/sapi/tests/test007.phpt
new file mode 100644
index 0000000..8c50e4b
--- /dev/null
+++ b/sapi/tests/test007.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Multipart Form POST Data, incorrect content length
+--HEADERS--
+return <<<END
+Content-Type=multipart/form-data; boundary=---------------------------240723202011929
+Content-Length=100
+END;
+--POST--
+-----------------------------240723202011929
+Content-Disposition: form-data; name="entry"
+
+entry box
+-----------------------------240723202011929
+Content-Disposition: form-data; name="password"
+
+password box
+-----------------------------240723202011929
+Content-Disposition: form-data; name="radio1"
+
+test 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="checkbox1"
+
+test 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="choices"
+
+Choice 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="choices"
+
+Choice 2
+-----------------------------240723202011929
+Content-Disposition: form-data; name="file"; filename="info.php"
+Content-Type: application/octet-stream
+
+<?php
+phpinfo();
+?>
+-----------------------------240723202011929--
+
+--FILE--
+<?php
+print @$_POST['choices'];
+?>
+--EXPECT--