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

index 5ab7459700ec619eddfeedd9910ccd5978ee6322..4845b27351ded6f783ea7df2eef5e0a5548a7865 100644 (file)
@@ -502,7 +502,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