[php-src] Issue #7854: Segfault with built-in webserver on one-arm match statement
| From: | Firehed | Date: | Wed, 29 Dec 2021 20:05:13 +0000 |
| Subject: | [php-src] Issue #7854: Segfault with built-in webserver on one-arm match statement | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238640@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7854
Author: Firehed
### Description
When running the following code with the built-in webserver, I experience a segfault:
https://3v4l.org/KrlXs
With one additional match arm (anything seems fine), it no longer occurs. I do not experience a
segfault when running on the command line. I have not yet tested under other server mechanisms (e.g.
fpm)
As far as I can tell, it's specific to the array destructuring; I've been able to
reproduce with a script as small as this:
```
$ cat repro.php
<?php
[$a, $b] = match (true) {
true => ['three', 'whatever'],
};
var_dump($a, $b);
$ php repro.php
string(5) "three"
string(8) "whatever"
$ php -S 0.0.0.0:12345 repro.php
[Wed Dec 29 12:02:49 2021] PHP 8.1.0 Development Server (http://0.0.0.0:12345) started
[Wed Dec 29 12:02:50 2021] 127.0.0.1:58865 Accepted
Segmentation fault: 11
```
(note my local machine is on 8.1.0 but the same happens in 8.1.1)
### PHP Version
8.1.1
### Operating System
macOS, Alpine Linux (docker)