[php-src] Issue #13867: do_operation ZEND_BOOL_NOT not invoked
| From: | ranvis | Date: | Tue, 02 Apr 2024 09:32:55 +0000 |
| Subject: | [php-src] Issue #13867: do_operation ZEND_BOOL_NOT not invoked | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246696@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13867
Author: ranvis
### Description
The object handler
do_operation is not invoked for the opcode
ZEND_BOOL_NOT.
With the supporting code for PHP 8.2 ext/zend_test https://github.com/ranvis/php-src/commit/2c542eef94de90b20b6e8d86ebeafee5408b12c9,
the following code:
```php
<?php
$a = new DoOperationNoCast(5);
var_dump(!$a);
```
Resulted in this output:
```
bool(false)
```
But I expected this output instead:
```
object(DoOperationNoCast)#2 (1) {
["val":"DoOperationNoCast":private]=>
int(0)
}
```
The code !$obj is evaluated as !(bool)$obj instead.
This appears to have been introduced on PHP 7.0, the commit https://github.com/php/php-src/commit/e6180ebb640408c7ded804f5f65282122a059ddb.
### PHP Version
dev-PHP-8.2
### Operating System
irrelevant