[php-src] Issue #9312: php segfaults on very special condition with opcache enabled
| From: | McJoey | Date: | Fri, 12 Aug 2022 11:38:35 +0000 |
| Subject: | [php-src] Issue #9312: php segfaults on very special condition with opcache enabled | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242197@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9312
Author: McJoey
### Description
The following code:
```php
<?php
$a = [(int)0];
print_r($a);
exit;
class A extends B {}
```
Resulted in this output:
```
Segmentation fault
```
But I expected this output instead:
```
Array ( [0] => 0 )
```
To reproduce this bug, all 4 conditions must be met:
1. opcache enabled (both, opcache.enabled=1 and opcache.enabled_cli=1)
2. create an array with at least one initial value being castet (independent of type)
3. callling exit
4. further code would throw a class not found error if being executed
Both php-cli and php-fpm are affected.
### PHP Version
PHP 8.1.8
### Operating System
Linux version 4.19.0-16-amd64 (Debian Buster)