immediately). (Laruence)
- Standard:
+ . Fixed bug #71245 (file_get_contents() ignores "header" context option if
+ it's a reference). (Laruence)
. Fixed bug #71220 (Null pointer deref (segfault) in compact via ob_start).
(hugh at allthethings dot co dot nz)
. Fixed bug #71190 (substr_replace converts integers in original $search
int ret = SUCCESS;
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(options), wkey, wval) {
- if (wkey && Z_TYPE_P(wval) == IS_ARRAY) {
-
+ ZVAL_DEREF(wval);
+ if (Z_TYPE_P(wval) == IS_ARRAY) {
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(wval), okey, oval) {
if (okey) {
+ ZVAL_DEREF(oval);
php_stream_context_set_option(context, ZSTR_VAL(wkey), ZSTR_VAL(okey), oval);
}
} ZEND_HASH_FOREACH_END();
--- /dev/null
+--TEST--
+Bug #71245 (file_get_contents() ignores "header" context option if it's a reference)
+--FILE--
+<?php
+$headers = ['Host: okey.com'];
+$httpContext = [
+ 'http' => [
+ 'protocol_version' => '1.1',
+ 'method' => 'GET',
+ 'header' => &$headers,
+ 'follow_location' => 0,
+ 'max_redirects' => 0,
+ 'ignore_errors' => true,
+ 'timeout' => 60,
+ ],
+];
+$context = stream_context_create($httpContext);
+$headers = ["Host: bad.com"];
+print_r(stream_context_get_options($context));
+?>
+--EXPECTF--
+Array
+(
+ [http] => Array
+ (
+ [protocol_version] => 1.1
+ [method] => GET
+ [header] => Array
+ (
+ [0] => Host: okey.com
+ )
+
+ [follow_location] => 0
+ [max_redirects] => 0
+ [ignore_errors] => 1
+ [timeout] => 60
+ )
+
+)