Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix failed assertion with throwing __toString in binary const expr
This commit is contained in:
Ilija Tovilo 2025-07-30 13:34:43 +02:00
commit 03e2613ddd
No known key found for this signature in database
GPG key ID: 115CEA7A713E12E9
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,22 @@
--TEST--
OSS-Fuzz #434346548: Failed assertion with throwing __toString in binary const expr
--FILE--
<?php
class Foo {
function __toString() {}
}
function test($y = new Foo() < "") {
var_dump();
}
try {
test();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Foo::__toString(): Return value must be of type string, none returned

View file

@ -610,9 +610,10 @@ ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
ret = FAILURE; ret = FAILURE;
} else { } else {
binary_op_type op = get_binary_op(ast->attr); binary_op_type op = get_binary_op(ast->attr);
ret = op(result, &op1, &op2); op(result, &op1, &op2);
zval_ptr_dtor_nogc(&op1); zval_ptr_dtor_nogc(&op1);
zval_ptr_dtor_nogc(&op2); zval_ptr_dtor_nogc(&op2);
ret = EG(exception) ? FAILURE : SUCCESS;
} }
break; break;
case ZEND_AST_GREATER: case ZEND_AST_GREATER: