]> granicus.if.org Git - php/commitdiff
Fixed test to work with recent libcurl versions
authorMatteo Beccati <mbeccati@php.net>
Wed, 29 Oct 2014 10:26:22 +0000 (11:26 +0100)
committerMatteo Beccati <mbeccati@php.net>
Wed, 29 Oct 2014 10:28:27 +0000 (11:28 +0100)
ext/standard/tests/file/bug52820.phpt

index 3a9f9c31a4676211a99f44d994d519b57e78b448..a00ebf50b633c25a5116a105f9603945c8a7bce4 100644 (file)
@@ -1,71 +1,63 @@
---TEST--\r
-Bug #52820 (writes to fopencookie FILE* not committed when seeking the stream)\r
---SKIPIF--\r
-<?php\r
-if (!function_exists('leak_variable'))\r
-   die("skip only for debug builds");\r
-/* unfortunately no standard function does a cast to FILE*, so we need\r
- * curl to test this */\r
-if (!extension_loaded("curl")) exit("skip curl extension not loaded");\r
-$handle=curl_init('http://127.0.0.1:37349/');\r
-curl_setopt($handle, CURLOPT_VERBOSE, true);\r
-curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);\r
-if (!curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))\r
-    die("skip fopencookie not supported on this platform");\r
---FILE--\r
-<?php\r
-function do_stuff($url) {\r
-    $handle=curl_init('http://127.0.0.1:37349/');\r
-    curl_setopt($handle, CURLOPT_VERBOSE, true);\r
-    curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);\r
-    curl_setopt($handle, CURLOPT_STDERR, $o = fopen($url, "w+"));\r
-    curl_exec($handle);\r
-    echo "About to rewind!\n";\r
-    rewind($o);\r
-    echo stream_get_contents($o);\r
-    return $o;\r
-}\r
-\r
-echo "temp stream (close after):\n";\r
-fclose(do_stuff("php://temp"));\r
-\r
-echo "\nmemory stream (close after):\n";\r
-fclose(do_stuff("php://memory"));\r
-\r
-echo "\ntemp stream (leak):\n";\r
-leak_variable(do_stuff("php://temp"), true);\r
-\r
-echo "\nmemory stream (leak):\n";\r
-leak_variable(do_stuff("php://memory"), true);\r
-\r
-echo "\nDone.\n";\r
---EXPECTF--\r
-temp stream (close after):\r
-About to rewind!\r
-* About to connect() to 127.0.0.1 port 37349%r.*%r\r
-*   Trying 127.0.0.1...%A* Connection refused\r
-* couldn't connect to host%S\r
-* Closing connection #0\r
-\r
-memory stream (close after):\r
-About to rewind!\r
-* About to connect() to 127.0.0.1 port 37349%r.*%r\r
-*   Trying 127.0.0.1...%A* Connection refused\r
-* couldn't connect to host%S\r
-* Closing connection #0\r
-\r
-temp stream (leak):\r
-About to rewind!\r
-* About to connect() to 127.0.0.1 port 37349%r.*%r\r
-*   Trying 127.0.0.1...%A* Connection refused\r
-* couldn't connect to host%S\r
-* Closing connection #0\r
-\r
-memory stream (leak):\r
-About to rewind!\r
-* About to connect() to 127.0.0.1 port 37349%r.*%r\r
-*   Trying 127.0.0.1...%A* Connection refused\r
-* couldn't connect to host%S\r
-* Closing connection #0\r
-\r
-Done.\r
+--TEST--
+Bug #52820 (writes to fopencookie FILE* not committed when seeking the stream)
+--SKIPIF--
+<?php
+if (!function_exists('leak_variable'))
+   die("skip only for debug builds");
+/* unfortunately no standard function does a cast to FILE*, so we need
+ * curl to test this */
+if (!extension_loaded("curl")) exit("skip curl extension not loaded");
+$handle=curl_init('http://127.0.0.1:37349/');
+curl_setopt($handle, CURLOPT_VERBOSE, true);
+curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
+if (!curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
+    die("skip fopencookie not supported on this platform");
+--FILE--
+<?php
+function do_stuff($url) {
+    $handle=curl_init('http://127.0.0.1:37349/');
+    curl_setopt($handle, CURLOPT_VERBOSE, true);
+    curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
+    curl_setopt($handle, CURLOPT_STDERR, $o = fopen($url, "w+"));
+    curl_exec($handle);
+    echo "About to rewind!\n";
+    rewind($o);
+    echo stream_get_contents($o);
+    return $o;
+}
+
+echo "temp stream (close after):\n";
+fclose(do_stuff("php://temp"));
+
+echo "\nmemory stream (close after):\n";
+fclose(do_stuff("php://memory"));
+
+echo "\ntemp stream (leak):\n";
+leak_variable(do_stuff("php://temp"), true);
+
+echo "\nmemory stream (leak):\n";
+leak_variable(do_stuff("php://memory"), true);
+
+echo "\nDone.\n";
+--EXPECTF--
+temp stream (close after):
+About to rewind!
+* %ATrying 127.0.0.1...%AConnection refused%A
+* Closing connection%A%d
+
+memory stream (close after):
+About to rewind!
+* %ATrying 127.0.0.1...%AConnection refused%A
+* Closing connection%A%d
+
+temp stream (leak):
+About to rewind!
+* %ATrying 127.0.0.1...%AConnection refused%A
+* Closing connection%A%d
+
+memory stream (leak):
+About to rewind!
+* %ATrying 127.0.0.1...%AConnection refused%A
+* Closing connection%A%d
+
+Done.