Skip to content

Regression: class_alias(internal) succeeds on PROFILE≤8.2 — Zend ValueError (re-#29084, Zend/zend_builtin_functions.c) #29150

Description

@PurHur

Category

Language · php-src-strict · profile gate · pillar 4

Problem

#29084 / #29106 made class_alias() of internal classes succeed to match Zend 8.3+. On Zend 8.1/8.2, the same call still throws ValueError: class_alias(): Argument #1 ($class) must be a user-defined class name, internal class name given.

With PHP_COMPILER_PROFILE=8.2 (and 8.1), VM/JIT still return true for stdClass / Exception / Traversable aliases — no profile gate.

Verified 2026-08-08 on master @ 98b7c4dc4b vs php:8.2-cli (8.2.32) and php:8.4-cli (8.4.24).

Repro Zend 8.2.32 Zend 8.4.24 VM/JIT PROFILE=8.2 VM PROFILE=8.4
class_alias(stdClass::class, 'A') ValueError true true true OK
class_alias(Exception::class, 'E') ValueError true true true OK
class_alias(User::class, 'U') (user) true true true OK true OK

php-src reference

  • php/php-src Zend/zend_builtin_functions.c (PHP-8.2)zend_argument_value_error(1, \"must be a user-defined class name, internal class name given\") for internal ce
  • Behavior change: restriction lifted in 8.3+ (no ValueError for fresh alias of internal class)

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
cat > /tmp/class_alias_internal_82.php << \"PHP\"
<?php
error_reporting(E_ALL);
try {
  var_export(class_alias(stdClass::class, \"AliasStd_\" . bin2hex(random_bytes(3))));
} catch (Throwable $e) {
  echo get_class($e), \":\", $e->getMessage();
}
echo \"\n\";
PHP
PHP_COMPILER_PROFILE=8.2 php bin/vm.php /tmp/class_alias_internal_82.php
PHP_COMPILER_PROFILE=8.2 php bin/jit.php /tmp/class_alias_internal_82.php
# expect ValueError matching php:8.2-cli
'

Done when

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions