]> granicus.if.org Git - php/commitdiff
- Fixed a segfault when reading from an HTTP stream.
authorDerick Rethans <derick@php.net>
Thu, 29 Nov 2007 12:27:49 +0000 (12:27 +0000)
committerDerick Rethans <derick@php.net>
Thu, 29 Nov 2007 12:27:49 +0000 (12:27 +0000)
ext/standard/http_fopen_wrapper.c
ext/standard/tests/network/http-stream.phpt [new file with mode: 0644]

index 849eb99ebfb560ab0ef824b32c003087c6ae11f7..ae572c42b4db54753dd97c0fb7bbf3fae3062d35 100644 (file)
@@ -545,7 +545,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
                        }
                        /* when we request only the header, don't fail even on error codes */
                        if ((options & STREAM_ONLY_GET_HEADERS) ||
-                               (php_stream_context_get_option(context, "http", "ignore_errors",  &tmpzval) == SUCCESS && zend_is_true(*tmpzval)) ) {
+                               (context && php_stream_context_get_option(context, "http", "ignore_errors",  &tmpzval) == SUCCESS && zend_is_true(*tmpzval)) ) {
                                reqok = 1;
                        }
                        switch(response_code) {
diff --git a/ext/standard/tests/network/http-stream.phpt b/ext/standard/tests/network/http-stream.phpt
new file mode 100644 (file)
index 0000000..3db3eb3
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--
+http-stream test
+--FILE--
+<?php
+$d = new DomDocument;
+$e = $d->load("http://php.net/news.rss");
+echo "ALIVE\n";
+?>
+--EXPECTF--
+ALIVE