Commit eb733a3127f for php.net
commit eb733a3127f8413058cc9abf28ed5d990ee32cd3
Merge: 30fbcf9d7ef 27f17c33227
Author: Niels Dossche <7771979+ndossche@users.noreply.github.com>
Date: Sun Nov 23 17:46:51 2025 +0100
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
Fix GH-20286: use-after-destroy during userland stream_close()
diff --cc ext/standard/tests/streams/gh20286.phpt
index 00000000000,b4d340a4390..6d15e167aee
mode 000000,100644..100644
--- a/ext/standard/tests/streams/gh20286.phpt
+++ b/ext/standard/tests/streams/gh20286.phpt
@@@ -1,0 -1,43 +1,43 @@@
+ --TEST--
+ GH-20286 use after destroy on userland stream_close
+ --CREDITS--
+ vi3tL0u1s
+ --SKIPIF--
+ <?php
+ if (substr(PHP_OS, 0, 3) == 'WIN') die('skip Aborts with STATUS_BAD_FUNCTION_TABLE on Windows');
+ ?>
+ --FILE--
+ <?php
+ class lib {
+ public $context;
+ function stream_set() {}
+ function stream_set_option() {}
+ function stream_stat() {
+ return true;
+ }
+ function stream_open() {
+ return true;
+ }
+
+ function stream_read($count) {
+ function a() {}
+ include('lib://');
+ }
+
+ function stream_close() {
+ static $count = 0;
+ if ($count++ < 3) // Prevent infinite loop
+ include('lib://');
+ }
+ }
+ stream_wrapper_register('lib', lib::class);
+ include('lib://test.php');
+ ?>
+ --EXPECTF--
-Fatal error: Cannot redeclare a() (previously declared in %s:%d) in %s on line %d
++Fatal error: Cannot redeclare function a() (previously declared in %s:%d) in %s on line %d
+
-Fatal error: Cannot redeclare a() (previously declared in %s on line %d
++Fatal error: Cannot redeclare function a() (previously declared in %s:%d) in %s on line %d
+
-Fatal error: Cannot redeclare a() (previously declared in %s on line %d
++Fatal error: Cannot redeclare function a() (previously declared in %s:%d) in %s on line %d
+
-Fatal error: Cannot redeclare a() (previously declared in %s on line %d
++Fatal error: Cannot redeclare function a() (previously declared in %s:%d) in %s on line %d