Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions ext/standard/io_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| https://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
| This source file is subject to the Modified BSD License that is |
| bundled with this package in the file LICENSE, and is available |
| through the World Wide Web at <https://www.php.net/license/>. |
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Author: Jakub Zelenka <bukka@php.net> |
+----------------------------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--TEST--
stream_context_set_option() on a context-less stream must not leak into the default context
--FILE--
<?php
$a = fopen('php://memory', 'r+');
stream_context_set_option($a, 'http', 'filename', 'test.txt');

// The default context must stay untouched.
var_dump(stream_context_get_options(stream_context_get_default()));

// A later context-less stream must not inherit the option.
$b = fopen('php://memory', 'r+');
var_dump(stream_context_get_options($b));

// The stream the option was set on keeps it for itself.
var_dump(stream_context_get_options($a));
?>
--EXPECT--
array(0) {
}
array(0) {
}
array(1) {
["http"]=>
array(1) {
["filename"]=>
string(8) "test.txt"
}
}
12 changes: 5 additions & 7 deletions main/streams/php_stream_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| https://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
| This source file is subject to the Modified BSD License that is |
| bundled with this package in the file LICENSE, and is available |
| through the World Wide Web at <https://www.php.net/license/>. |
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Jakub Zelenka <bukka@php.net> |
+----------------------------------------------------------------------+
Expand Down
12 changes: 5 additions & 7 deletions main/streams/stream_errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| https://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
| This source file is subject to the Modified BSD License that is |
| bundled with this package in the file LICENSE, and is available |
| through the World Wide Web at <https://www.php.net/license/>. |
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Jakub Zelenka <bukka@php.net> |
+----------------------------------------------------------------------+
Expand Down
7 changes: 6 additions & 1 deletion main/streams/streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,12 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
stream->open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename;
stream->open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno;
#endif
if (stream->ctx == NULL && context != NULL && !persistent) {
/* Attach an explicitly provided context to the stream, but never the
* default context: sharing it by reference would let a later
* stream_context_set_option() on the stream mutate the global default
* context, leaking options into every other stream. Stream errors fall
* back to the default context on their own when the stream has none. */
if (stream->ctx == NULL && context != NULL && context != FG(default_context) && !persistent) {
php_stream_context_set(stream, context);
}
}
Expand Down
Loading