Skip to content

token_get_all with TOKEN_PARSE types the visibility in a as protected; as T_STRING instead of T_PROTECTED #343

Closed

Description

@blacktrs

Summary

token_get_all with TOKEN_PARSE types the visibility in a as protected; as T_STRING instead of T_PROTECTED.

Repro

<?php
$src = "<?php class A { use T { a as protected; b as private c; } }";
foreach (token_get_all($src, TOKEN_PARSE) as $t) {
    if (is_array($t) && $t[0] !== T_WHITESPACE) { echo token_name($t[0]), ' ', $t[1], "\n"; }
}

Expected (php)

T_OPEN_TAG <?php 
T_CLASS class
T_STRING A
T_USE use
T_STRING T
T_STRING a
T_AS as
T_PROTECTED protected
T_STRING b
T_AS as
T_PRIVATE private
T_STRING c

Actual (manticore fe5476b4, Darwin arm64)

T_OPEN_TAG <?php 
T_CLASS class
T_STRING A
T_USE use
T_STRING T
T_STRING a
T_AS as
T_STRING protected
T_STRING b
T_AS as
T_PRIVATE private
T_STRING c

Tracking

Known-bug repro: tests/aot/repro/wrong/token_get_all_trait_alias_visibility.php — bash tests/aot/xfail.sh -k token_get_all_trait_alias_visibility reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 18, 2026
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

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions