php / php-src

The PHP Interpreter
https://www.php.net
Other
38.09k stars 7.74k forks source link

Assertion failure in Zend/zend_API.c:501 #16405

Open YuanchengJiang opened 3 days ago

YuanchengJiang commented 3 days ago

Description

The following code:

<?php
$b = gmp_init(17);
var_dump($fusion << $b);

Resulted in this output:

/php-src/Zend/zend_API.c:501: _Bool zend_null_arg_deprecated(const char *, uint32_t): Assertion `func->common.fn_flags & (1 << 14)' failed.
Aborted (core dumped)

Related: #16354

PHP Version

nightly

Operating System

ubuntu 22.04

devnexen commented 3 days ago

It is kind of the same issue only this time, it expects it to be a variable length args function. @cmb69 did I got it right ?

cmb69 commented 3 days ago

@devnexen, the problem is again that operator overloading is used, but not a function. The implementation of zend_parse_arg_long_slow() calls zend_null_arg_deprecated() for NULL arguments, and that function always expects to be called from a PHP function. PR #16015 would solve this by rejecting NULL values for operator overloading.