diff --git a/ext/gd/tests/imageloadfont_error1.phpt b/ext/gd/tests/imageloadfont_error1.phpt index 16d1a3c3a67..418bbf3cedb 100644 --- a/ext/gd/tests/imageloadfont_error1.phpt +++ b/ext/gd/tests/imageloadfont_error1.phpt @@ -3,7 +3,7 @@ Testing that imageloadfont() breaks on non-string first parameter --CREDITS-- Neveo Harrison #testfest #tek11 --SKIPIF-- - --FILE-- @@ -11,5 +11,5 @@ Neveo Harrison #testfest #tek11 var_dump( imageloadfont(array()) ); ?> --EXPECTF-- -Warning: imageloadfont() expects parameter 1 to be string, array given in %s on line %d -NULL \ No newline at end of file +Warning: imageloadfont() expects parameter 1 to be a valid path, array given in %s on line %d +NULL diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 3a53ae462ed..95f9cb5c845 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -922,8 +922,13 @@ out: if (transfer_encoding) { php_stream_filter_append(&stream->readfilters, transfer_encoding); } - } else if (transfer_encoding) { - php_stream_filter_free(transfer_encoding TSRMLS_CC); + } else { + if(response_header) { + Z_DELREF_P(response_header); + } + if (transfer_encoding) { + php_stream_filter_free(transfer_encoding TSRMLS_CC); + } } return stream; diff --git a/ext/standard/tests/http/bug69337.phpt b/ext/standard/tests/http/bug69337.phpt new file mode 100644 index 00000000000..1451d4bf01d --- /dev/null +++ b/ext/standard/tests/http/bug69337.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #69337 (Stream context leaks when http request fails) +--SKIPIF-- + +--INI-- +allow_url_fopen=1 +allow_url_include=1 +--FILE-- + "stream_notification_callback")); + +$responses = array( + "data://text/plain,HTTP/1.0 302 Found\r\nLocation: http://127.0.0.1:22345/try-again\r\n\r\n", + "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", +); + +$pid = http_server("tcp://127.0.0.1:22345", $responses, $output); + +$f = file_get_contents('http://127.0.0.1:22345/', 0, $ctx); + +http_server_kill($pid); +var_dump($f); +?> +==DONE== +--EXPECTF-- +string(26) "HTTP/1.0 404 Not Found + +" +==DONE== \ No newline at end of file diff --git a/ext/zlib/tests/gzopen_variation1.phpt b/ext/zlib/tests/gzopen_variation1.phpt index c5a47f4d089..bca48f39c99 100644 --- a/ext/zlib/tests/gzopen_variation1.phpt +++ b/ext/zlib/tests/gzopen_variation1.phpt @@ -1,17 +1,17 @@ --TEST-- -Test gzopen() function : usage variation +Test gzopen() function : usage variation --SKIPIF-- - --FILE-- @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for filename @@ -158,19 +158,19 @@ Error: 2 - gzopen(0.5): failed to open stream: No such file or directory, %s(%d) bool(false) --empty array-- -Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d) +Error: 2 - gzopen() expects parameter 1 to be a valid path, array given, %s(%d) NULL --int indexed array-- -Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d) +Error: 2 - gzopen() expects parameter 1 to be a valid path, array given, %s(%d) NULL --associative array-- -Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d) +Error: 2 - gzopen() expects parameter 1 to be a valid path, array given, %s(%d) NULL --nested arrays-- -Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d) +Error: 2 - gzopen() expects parameter 1 to be a valid path, array given, %s(%d) NULL --uppercase NULL-- @@ -210,7 +210,7 @@ Error: 2 - gzopen(Class A object): failed to open stream: No such file or direct bool(false) --instance of classWithoutToString-- -Error: 2 - gzopen() expects parameter 1 to be string, object given, %s(%d) +Error: 2 - gzopen() expects parameter 1 to be a valid path, object given, %s(%d) NULL --undefined var-- @@ -222,7 +222,7 @@ Error: 2 - gzopen(): Filename cannot be empty, %s(%d) bool(false) --resource-- -Error: 2 - gzopen() expects parameter 1 to be string, resource given, %s(%d) +Error: 2 - gzopen() expects parameter 1 to be a valid path, resource given, %s(%d) NULL ===DONE=== diff --git a/ext/zlib/tests/readgzfile_variation1.phpt b/ext/zlib/tests/readgzfile_variation1.phpt index 5a5ec4f6e74..5d9b639d29b 100644 --- a/ext/zlib/tests/readgzfile_variation1.phpt +++ b/ext/zlib/tests/readgzfile_variation1.phpt @@ -29,15 +29,15 @@ foreach ( $variation as $var ) { ===DONE=== --EXPECTF-- -Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d +Warning: readgzfile() expects parameter 1 to be a valid path, array given in %s on line %d NULL -Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d +Warning: readgzfile() expects parameter 1 to be a valid path, array given in %s on line %d NULL -Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d +Warning: readgzfile() expects parameter 1 to be a valid path, array given in %s on line %d NULL -Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d +Warning: readgzfile() expects parameter 1 to be a valid path, array given in %s on line %d NULL -===DONE=== \ No newline at end of file +===DONE=== diff --git a/ext/zlib/tests/readgzfile_variation6.phpt b/ext/zlib/tests/readgzfile_variation6.phpt index 702f91850ef..9fcea02939c 100644 --- a/ext/zlib/tests/readgzfile_variation6.phpt +++ b/ext/zlib/tests/readgzfile_variation6.phpt @@ -45,5 +45,5 @@ foreach ( $variation as $var ) { --EXPECTF-- Error: 2 - readgzfile(Class A object): failed to open stream: No such file or directory, %s(%d) bool(false) -Error: 2 - readgzfile() expects parameter 1 to be string, object given, %s(%d) -NULL \ No newline at end of file +Error: 2 - readgzfile() expects parameter 1 to be a valid path, object given, %s(%d) +NULL