Closed
Description
Description
The following code:
<?php
\preg_replace('/pattern/', 'replace', 'subject');
class wrapper
{
public function stream_open($path, $mode, $options, &$opened_path)
{
echo __METHOD__.PHP_EOL;
return true;
}
public function stream_close()
{
echo __METHOD__.PHP_EOL;
\preg_replace('/pattern/', 'replace', 'subject');
}
public $context;
}
echo \php_sapi_name().PHP_EOL;
\stream_wrapper_register('wrapper', 'wrapper');
$handle = \fopen('wrapper://', 'rb');
Resulted in this output (PHP 8.3.9, 8.3.0, 8.2.0, 7.4.0):
cli
wrapper::stream_open
ERRORLEVEL -1073741819 (0xC0000005) Access violation
Resulted in this output (PHP 8.1.0, 8.0.0):
cli
wrapper::stream_open
ERRORLEVEL -1073740791 (0xC0000409) Stack buffer overrun
But I expected this output instead:
cli
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