Skip to content

Preloading with internal class alias triggers assertion failure #18567

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

Closed
DanielEScherzer opened this issue May 15, 2025 · 0 comments
Closed

Comments

@DanielEScherzer
Copy link
Member

DanielEScherzer commented May 15, 2025

Description

The following code:

preload.php:

<?php
class_alias('Stringable', 'MyStringable');

Resulted in this output:

php: /usr/src/php83/ext/opcache/ZendAccelerator.c:3907: preload_link: Assertion `ce->type != 1' failed.
Aborted (core dumped)

When invoked with: php -d opcache.enable=1 -d opcache.enable_cli=1 -d "zend_extension=opcache.so" -d opcache.preload=/var/www/html/preload.php -v

But I expected this output instead:

[not a segfault]

PHP Version

PHP @ 8da9530

Operating System

No response

@nielsdos nielsdos self-assigned this May 16, 2025
nielsdos added a commit to nielsdos/php-src that referenced this issue May 16, 2025
…ion failure

The assertion is imprecise now, and the code assumed that from the
moment an internal class was encountered that there were only internal
classes remaining. This is wrong now, and we still have to continue if
we encounter an internal class. We can only skip the remaining iterations
if the entry in the hash table is not an alias.
nielsdos added a commit to nielsdos/php-src that referenced this issue May 17, 2025
…ion failure

The assertion is imprecise now, and the code assumed that from the
moment an internal class was encountered that there were only internal
classes remaining. This is wrong now, and we still have to continue if
we encounter an internal class. We can only skip the remaining iterations
if the entry in the hash table is not an alias.
nielsdos added a commit that referenced this issue May 19, 2025
* PHP-8.3:
  Fix GH-18567: Preloading with internal class alias triggers assertion failure
nielsdos added a commit that referenced this issue May 19, 2025
* PHP-8.4:
  Fix GH-18567: Preloading with internal class alias triggers assertion failure
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.

2 participants