summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2007-11-29 12:27:49 +0000
committerDerick Rethans <derick@php.net>2007-11-29 12:27:49 +0000
commitbadfa1304d60da8829ff9b80a7c8971f1a90f633 (patch)
treeb634daeaf8cdb0038d5ad32d922526761f474efc
parente75caf3a86e08960bff3ae4be3618e3f3955bb85 (diff)
downloadphp-git-badfa1304d60da8829ff9b80a7c8971f1a90f633.tar.gz
- Fixed a segfault when reading from an HTTP stream.
-rw-r--r--ext/standard/http_fopen_wrapper.c2
-rw-r--r--ext/standard/tests/network/http-stream.phpt10
2 files changed, 11 insertions, 1 deletions
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 849eb99ebf..ae572c42b4 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -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
index 0000000000..3db3eb372f
--- /dev/null
+++ b/ext/standard/tests/network/http-stream.phpt
@@ -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