Annotation of embedaddon/php/ext/standard/tests/file/bug52820.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #52820 (writes to fopencookie FILE* not commited when seeking the stream)
                      3: --SKIPIF--
                      4: <?php
                      5: /* unfortunately no standard function does a cast to FILE*, so we need
                      6:  * curl to test this */
                      7: if (!extension_loaded("curl")) exit("skip curl extension not loaded");
                      8: $handle=curl_init('http://127.0.0.1:37349/');
                      9: curl_setopt($handle, CURLOPT_VERBOSE, true);
                     10: curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
                     11: if (!curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
                     12:     die("skip fopencookie not supported on this platform");
                     13: --FILE--
                     14: <?php
                     15: function do_stuff($url) {
                     16:     $handle=curl_init('http://127.0.0.1:37349/');
                     17:     curl_setopt($handle, CURLOPT_VERBOSE, true);
                     18:     curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
                     19:     curl_setopt($handle, CURLOPT_STDERR, $o = fopen($url, "w+"));
                     20:     curl_exec($handle);
                     21:     echo "About to rewind!\n";
                     22:     rewind($o);
                     23:     echo stream_get_contents($o);
                     24:     return $o;
                     25: }
                     26: 
                     27: echo "temp stream (close after):\n";
                     28: fclose(do_stuff("php://temp"));
                     29: 
                     30: echo "\nmemory stream (close after):\n";
                     31: fclose(do_stuff("php://memory"));
                     32: 
                     33: echo "\nDone.\n";
                     34: --EXPECT--
                     35: temp stream (close after):
                     36: About to rewind!
                     37: * About to connect() to 127.0.0.1 port 37349 (#0)
                     38: *   Trying 127.0.0.1... * Connection refused
                     39: * couldn't connect to host
                     40: * Closing connection #0
                     41: 
                     42: memory stream (close after):
                     43: About to rewind!
                     44: * About to connect() to 127.0.0.1 port 37349 (#0)
                     45: *   Trying 127.0.0.1... * Connection refused
                     46: * couldn't connect to host
                     47: * Closing connection #0
                     48: 
                     49: Done.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>