[php-src] Issue #15064: PCRE pattern cache crashes process in wrapper stream_close called after shutdown

From: Date: Mon, 22 Jul 2024 15:09:38 +0000
Subject: [php-src] Issue #15064: PCRE pattern cache crashes process in wrapper stream_close called after shutdown
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247340@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15064 Author: nicolaslegland ### Description The following code: ```php <?php \preg_replace('/pattern/', 'replace', 'subject'); class wrapper { public function stream_open($path, $mode, $options, &$opened_path) { return true; } public function stream_close() { \preg_replace('/pattern/', 'replace', 'subject'); } public $context; } \stream_wrapper_register('wrapper', 'wrapper'); $handle = \fopen('wrapper://', 'rb'); ``` Resulted in this output: ``` wrapper::stream_open ERRORLEVEL -1073741819 (0xC0000005) Access violation ``` But I expected this output instead: ``` wrapper::stream_open wrapper::stream_close ERRORLEVEL 0 ``` ### PHP Version PHP 8.3.9, 8.3.0, 8.2.0, 8.1.0, 8.0.0, 7.4.0 ### Operating System Windows 11 Pro, Build 22621.ni_release.220506-1250

« previous php.bugs (#247340) next »