[php-src] Issue #9920: Exception message is not on point for unary operator
| From: | mvorisek | Date: | Thu, 10 Nov 2022 08:52:57 +0000 |
| Subject: | [php-src] Issue #9920: Exception message is not on point for unary operator | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242780@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9920
Author: mvorisek
### Description
The following code:
```php
var_dump(- '3');
$v = 'x';
var_dump(- $v);
var_dump(- 'x');
```
https://3v4l.org/tokuW
Resulted in this output:
```
int(-3)
Fatal error: Uncaught TypeError: Unsupported operand types: string * int in /in/tokuW:5
Stack trace:
#0 {main}
thrown in /in/tokuW on line 5
```
But I expected this output instead:
```
int(-3)
1x meaningful exception (or 2x warning)
```
### PHP Version
PHP 8.0+
### Operating System
any