We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6bd0175 commit df033e3Copy full SHA for df033e3
main/php_streams.h
@@ -185,6 +185,9 @@ struct _php_stream_wrapper {
185
* Currently for internal use only. */
186
#define PHP_STREAM_FLAG_SUPPRESS_ERRORS 0x100
187
188
+/* Do not close handle except it is explicitly closed by user (e.g. fclose) */
189
+#define PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE 0x200
190
+
191
#define PHP_STREAM_FLAG_WAS_WRITTEN 0x80000000
192
193
struct _php_stream {
main/streams/streams.c
@@ -383,7 +383,8 @@ PHPAPI int _php_stream_free(php_stream *stream, int close_options) /* {{{ */
383
384
context = PHP_STREAM_CONTEXT(stream);
385
386
- if (stream->flags & PHP_STREAM_FLAG_NO_CLOSE) {
+ if ((stream->flags & PHP_STREAM_FLAG_NO_CLOSE) ||
387
+ ((stream->flags & PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE) && (close_options & PHP_STREAM_FREE_RSRC_DTOR))) {
388
preserve_handle = 1;
389
}
390
sapi/cli/php_cli.c
@@ -540,9 +540,9 @@ static void cli_register_file_handles(void) /* {{{ */
540
* extensions which write to stderr or company during mshutdown/gshutdown
541
* won't have the expected functionality.
542
*/
543
- if (s_in) s_in->flags |= PHP_STREAM_FLAG_NO_CLOSE;
544
- if (s_out) s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;
545
- if (s_err) s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE;
+ if (s_in) s_in->flags |= PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE;
+ if (s_out) s_out->flags |= PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE;
+ if (s_err) s_err->flags |= PHP_STREAM_FLAG_NO_RSCR_DTOR_CLOSE;
546
547
if (s_in==NULL || s_out==NULL || s_err==NULL) {
548
if (s_in) php_stream_close(s_in);
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments