Skip to content

Commit badfa13

Browse files
author
Derick Rethans
committed
- Fixed a segfault when reading from an HTTP stream.
1 parent e75caf3 commit badfa13

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ext/standard/http_fopen_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
545545
}
546546
/* when we request only the header, don't fail even on error codes */
547547
if ((options & STREAM_ONLY_GET_HEADERS) ||
548-
(php_stream_context_get_option(context, "http", "ignore_errors", &tmpzval) == SUCCESS && zend_is_true(*tmpzval)) ) {
548+
(context && php_stream_context_get_option(context, "http", "ignore_errors", &tmpzval) == SUCCESS && zend_is_true(*tmpzval)) ) {
549549
reqok = 1;
550550
}
551551
switch(response_code) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
http-stream test
3+
--FILE--
4+
<?php
5+
$d = new DomDocument;
6+
$e = $d->load("http://php.net/news.rss");
7+
echo "ALIVE\n";
8+
?>
9+
--EXPECTF--
10+
ALIVE

0 commit comments

Comments
 (0)