do_operation ZEND_BOOL_NOT not invoked
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
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
$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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the PHP interpreter's handling of the ZEND_BOOL_NOT opcode and the object handler do_operation, using the ext/zend_test supporting code and the linked PHP 7.0 change as context. Run the provided DoOperationNoCast example on PHP 8.2 and verify that the handler is invoked and the result matches the expected object output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100