Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpdbg: Assertion failure on i funcs #15901

Closed
YuanchengJiang opened this issue Sep 16, 2024 · 2 comments
Closed

phpdbg: Assertion failure on i funcs #15901

YuanchengJiang opened this issue Sep 16, 2024 · 2 comments

Comments

@YuanchengJiang
Copy link

Description

The following code:

i funcs

Resulted in this output:

/php-src/sapi/phpdbg/phpdbg_info.c:448: phpdbg_do_info_funcs: Assertion `(((__ht)->u.flags & (1<<2)) != 0)' failed.
Aborted (core dumped)

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

@cmb69
Copy link
Member

cmb69 commented Sep 16, 2024

Indeed, that happens when no userland function has been defined, in which case the following loop is invalid:

ZEND_HASH_PACKED_FOREACH_PTR(&functions, zf) {

That loop may be guarded with

	if (HT_IS_PACKED(&functions)) {

The same happens for i classes,

@nielsdos
Copy link
Member

@cmb69 Looks right to me, feel free to make a PR.

@cmb69 cmb69 changed the title Core dumped in phpdbg i funcs phpdbg: Assertion failure on i funcs Sep 16, 2024
cmb69 added a commit to cmb69/php-src that referenced this issue Sep 16, 2024
New hash tables are not automatically packed, so we must not treat them
as such.  Therefore we guard the foreach appropriately.
@cmb69 cmb69 linked a pull request Sep 16, 2024 that will close this issue
@cmb69 cmb69 self-assigned this Sep 16, 2024
cmb69 added a commit that referenced this issue Sep 18, 2024
* PHP-8.2:
  Fix GH-15901: phpdbg: Assertion failure on `i funcs`
@cmb69 cmb69 closed this as completed in 422aa17 Sep 18, 2024
cmb69 added a commit that referenced this issue Sep 18, 2024
* PHP-8.3:
  Fix GH-15901: phpdbg: Assertion failure on `i funcs`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants