summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/curl/tests/bug62839.phpt2
-rw-r--r--ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt52
-rw-r--r--ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt58
-rw-r--r--ext/standard/tests/strings/http_build_query_error.phpt13
-rw-r--r--sapi/cli/php_http_parser.c3
-rw-r--r--sapi/cli/php_http_parser.h1
-rw-r--r--sapi/cli/tests/php_cli_server_018.phpt44
-rw-r--r--win32/build/libs_version.txt8
8 files changed, 176 insertions, 5 deletions
diff --git a/ext/curl/tests/bug62839.phpt b/ext/curl/tests/bug62839.phpt
index 39e6fc9cbe..e6988d6de1 100644
--- a/ext/curl/tests/bug62839.phpt
+++ b/ext/curl/tests/bug62839.phpt
@@ -7,7 +7,7 @@ Bug #62839 (curl_copy_handle segfault with CURLOPT_FILE)
<?php
$curl = curl_init();
-$fd = fopen('/tmp/test', 'wb');
+$fd = tmpfile();
curl_setopt($curl, CURLOPT_FILE, $fd);
curl_copy_handle($curl);
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
new file mode 100644
index 0000000000..5107cd32b6
--- /dev/null
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
@@ -0,0 +1,52 @@
+--TEST--
+RecursiveDirectoryIterator::getBasePath() - basic test
+--CREDITS--
+Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+<?php
+$depth0 = md5('recursiveDirectoryIterator::getSubPath');
+$depth1 = md5('depth1');
+$depth2 = md5('depth2');
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
+mkdir($targetDir, 0777, true);
+touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPath_test.tmp');
+$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
+$it = new RecursiveIteratorIterator($iterator);
+
+$list = [];
+while($it->valid()) {
+ $list[] = $it->getSubPath();
+ $it->next();
+}
+asort($list);
+foreach ($list as $item) {
+ echo $item . "\n";
+}
+?>
+==DONE==
+--CLEAN--
+<?php
+function rrmdir($dir) {
+ foreach(glob($dir . '/*') as $file) {
+ if(is_dir($file)) {
+ rrmdir($file);
+ } else {
+ unlink($file);
+ }
+ }
+
+ rmdir($dir);
+ }
+
+ $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('recursiveDirectoryIterator::getSubPath');
+ rrmdir($targetDir);
+?>
+
+--EXPECT--
+a0c967a6c2c34786e4802f59af9356f5
+a0c967a6c2c34786e4802f59af9356f5
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507
+==DONE==
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
new file mode 100644
index 0000000000..4e17ea9d42
--- /dev/null
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+RecursiveDirectoryIterator::getBasePathname() - basic test
+--CREDITS--
+Pawel Krynicki <pawel [dot] krynicki [at] xsolve [dot] pl>
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+<?php
+$depth0 = md5('recursiveDirectoryIterator::getSubPathname');
+$depth1 = md5('depth1');
+$depth2 = md5('depth2');
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . $depth2;
+mkdir($targetDir, 0777, true);
+touch($targetDir . DIRECTORY_SEPARATOR . 'getSubPathname_test_2.tmp');
+touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . $depth1 . DIRECTORY_SEPARATOR . 'getSubPathname_test_3.tmp');
+touch(__DIR__ . DIRECTORY_SEPARATOR . $depth0 . DIRECTORY_SEPARATOR . 'getSubPathname_test_1.tmp');
+$iterator = new RecursiveDirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . $depth0);
+$it = new RecursiveIteratorIterator($iterator);
+
+$list = [];
+while($it->valid()) {
+ $list[] = $it->getSubPathname();
+ $it->next();
+}
+asort($list);
+foreach ($list as $item) {
+ echo $item . "\n";
+}
+?>
+==DONE==
+--CLEAN--
+<?php
+function rrmdir($dir) {
+ foreach(glob($dir . '/*') as $file) {
+ if(is_dir($file)) {
+ rrmdir($file);
+ } else {
+ unlink($file);
+ }
+ }
+
+ rmdir($dir);
+}
+
+$targetDir = __DIR__ . DIRECTORY_SEPARATOR . md5('recursiveDirectoryIterator::getSubPathname');
+rrmdir($targetDir);
+?>
+--EXPECT--
+.
+.
+..
+a0c967a6c2c34786e4802f59af9356f5/.
+a0c967a6c2c34786e4802f59af9356f5/..
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/.
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/..
+a0c967a6c2c34786e4802f59af9356f5/9925aabb545352472e4d77942627b507/getSubPathname_test_2.tmp
+a0c967a6c2c34786e4802f59af9356f5/getSubPathname_test_3.tmp
+getSubPathname_test_1.tmp
+==DONE==
diff --git a/ext/standard/tests/strings/http_build_query_error.phpt b/ext/standard/tests/strings/http_build_query_error.phpt
new file mode 100644
index 0000000000..30155e62a3
--- /dev/null
+++ b/ext/standard/tests/strings/http_build_query_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Testing error on null parameter 1 of http_build_query()
+--CREDITS--
+Pawel Krynicki <pawel.krynicki [at] xsolve [dot] pl>
+#testfest AmsterdamPHP 2012-06-23
+--FILE--
+<?php
+
+$result = http_build_query(null);
+
+?>
+--EXPECTF--
+Warning: http_build_query(): Parameter 1 expected to be Array or Object. %s value given in %s on line %d \ No newline at end of file
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index 4a95f82575..d3bc496f4e 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -81,6 +81,7 @@ static const char *method_strings[] =
, "HEAD"
, "POST"
, "PUT"
+ , "PATCH"
, "CONNECT"
, "OPTIONS"
, "TRACE"
@@ -627,6 +628,8 @@ size_t php_http_parser_execute (php_http_parser *parser,
parser->method = PHP_HTTP_PROPFIND; /* or HTTP_PROPPATCH */
} else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'U') {
parser->method = PHP_HTTP_PUT;
+ } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'A') {
+ parser->method = PHP_HTTP_PATCH;
} else if (index == 2 && parser->method == PHP_HTTP_UNLOCK && ch == 'S') {
parser->method = PHP_HTTP_UNSUBSCRIBE;
} else if (index == 4 && parser->method == PHP_HTTP_PROPFIND && ch == 'P') {
diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h
index 0f6c13dd35..2bf2356725 100644
--- a/sapi/cli/php_http_parser.h
+++ b/sapi/cli/php_http_parser.h
@@ -80,6 +80,7 @@ enum php_http_method
, PHP_HTTP_HEAD
, PHP_HTTP_POST
, PHP_HTTP_PUT
+ , PHP_HTTP_PATCH
/* pathological */
, PHP_HTTP_CONNECT
, PHP_HTTP_OPTIONS
diff --git a/sapi/cli/tests/php_cli_server_018.phpt b/sapi/cli/tests/php_cli_server_018.phpt
new file mode 100644
index 0000000000..deb9348768
--- /dev/null
+++ b/sapi/cli/tests/php_cli_server_018.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Implement Req #61679 (Support HTTP PATCH method)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+include "php_cli_server.inc";
+php_cli_server_start(<<<'PHP'
+var_dump($_SERVER['REQUEST_METHOD']);
+PHP
+);
+
+list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+$port = intval($port)?:80;
+
+$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+if (!$fp) {
+ die("connect failed");
+}
+
+if(fwrite($fp, <<<HEADER
+PATCH / HTTP/1.1
+Host: {$host}
+
+
+HEADER
+)) {
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
+}
+
+fclose($fp);
+?>
+--EXPECTF--
+HTTP/1.1 200 OK
+Host: %s
+Connection: close
+X-Powered-By: %s
+Content-type: text/html
+
+string(5) "PATCH"
diff --git a/win32/build/libs_version.txt b/win32/build/libs_version.txt
index 0d1af3d1b4..3df3be3795 100644
--- a/win32/build/libs_version.txt
+++ b/win32/build/libs_version.txt
@@ -4,13 +4,13 @@ freetype-2.4.3
icu-4.6.1
jpeglib-6b
libcurl-7.24.0
-libiconv-1.11
+libiconv-1.14
libmcrypt-2.5.8
libmpir-2.5.1
libpng-1.2.46
libpq-8.3.6
libssh2-1.3.0
libtidy-20090325
-libxslt-1.1.23
-libxml-2.7.7
-openssl-0.9.8u
+libxslt-1.1.27
+libxml-2.7.8
+openssl-0.9.8x