|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.4.0beta3
+- Core:
+ . Fixed bug #78396 (Second file_put_contents in Shutdown hangs script).
+ (Nikita)
+
- Date:
. Fixed bug #78383 (Casting a DateTime to array no longer returns its
properties). (Nikita)
--- /dev/null
+--TEST--
+Bug #78396: Second file_put_contents in Shutdown hangs script
+--FILE--
+<?php
+
+register_shutdown_function(function () {
+ file_put_contents(__DIR__ . '/bug78396.txt', '1', FILE_APPEND | LOCK_EX);
+ file_put_contents(__DIR__ . '/bug78396.txt', '2', FILE_APPEND | LOCK_EX);
+ echo "Done\n";
+});
+
+?>
+--CLEAN--
+<?php
+unlink(__DIR__ . '/bug78396.txt');
+?>
+--EXPECT--
+Done
zend_llist_destroy(&CG(open_files));
} zend_end_try();
+ EG(flags) |= EG_FLAGS_IN_RESOURCE_SHUTDOWN;
zend_try {
zend_close_rsrc_list(&EG(regular_list));
} zend_end_try();
#define EG_FLAGS_INITIAL (0)
#define EG_FLAGS_IN_SHUTDOWN (1<<0)
#define EG_FLAGS_OBJECT_STORE_NO_REUSE (1<<1)
+#define EG_FLAGS_IN_RESOURCE_SHUTDOWN (1<<2)
struct _zend_ini_scanner_globals {
zend_file_handle *yy_in;
* stream free operations in shutdown unless they come from the resource list destruction,
* or by freeing an enclosed stream (in which case resource list destruction will not have
* freed it). */
- if ((EG(flags) & EG_FLAGS_IN_SHUTDOWN) &&
+ if ((EG(flags) & EG_FLAGS_IN_RESOURCE_SHUTDOWN) &&
!(close_options & (PHP_STREAM_FREE_RSRC_DTOR|PHP_STREAM_FREE_IGNORE_ENCLOSING))) {
return 1;
}