-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Change in class name resolution for self
, parent
and static
#18373
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
Comments
@Girgias I'm not sure if this is related to your name resolution change. I'm on mobile and will check later, feel free to unassign if not. |
This was introduced in #17755 |
@thekid 3v4l does show the data after the NUL byte, though. |
You're right, as does a PHP binary I compiled myself from a current GIT checkout on WSL/Ubuntu: $ ./sapi/cli/php -v
PHP 8.5.0-dev (cli) (built: Apr 21 2025 11:34:35) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.5.0-dev, Copyright (c) Zend Technologies
$ ./sapi/cli/php /mnt/c/Tools/Cygwin/home/timmf/devel/xp/core/reflect.php
class@anonymous/mnt/c/Tools/Cygwin/home/timmf/devel/xp/core/reflect.php:10$0 The PHP binary used above is from https://github.com/shivammathur/php-builder-windows/actions/runs/14564331124 ( |
Are you sure about it? It seems to work just "fine" https://3v4l.org/5D2aT/rfc#vgit.master, but if it causes issues preventing the resolution of |
Excluding anonymous classes seems sensible, restricting substitution in |
At least with the Windows binaries, I've been able to reproduce. I don't have the PHP build system available on my machine, there are no PHP 8.5-binaries on https://windows.php.net/download/, so I use the ones from https://github.com/shivammathur/php-builder-windows/actions. Their build from today exhibits the same faulty behavior. With a PHP compiled from scratch on WSL, I cannot reproduce the issue - and 3v4l uses Linux builds, too. Is this maybe a Windows-only thing? /cc @shivammathur |
Description
The following code:
Resulted in this output:
At first sight, this is OK, as it seems PHP simply resolves the name now. However, after checking the details, this is not the real class name as everything after the NUL byte in the anonymous class name is truncated. If we now try to re-create a
ReflectionClass
instance, we will see a ReflectionException: Class "class@anonymous" does not exist error.But I expected this output instead:
or
PHP Version
PHP 8.5.0-dev (cli) (built: Apr 20 2025 23:34:30) (NTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Zend Engine v4.5.0-dev, Copyright (c) Zend Technologies
Operating System
Windows
The text was updated successfully, but these errors were encountered: