You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lone namespace separator asks the autoloader for an empty class name #23232
is_callable() on a string of the form '\::method' asks the autoloader for the empty class name. The same string without the leading backslash, '::method', does not autoload at all. A leading \ only marks the name as fully qualified, so this asymmetry looks like a bug.
Reproduced unchanged on 8.3.32, 8.4.24 and 8.5.9 (official php:*-cli images).
An empty class name can never resolve, so autoloading it is pure overhead — and it is observable overhead. Composer's ClassLoader::findFileWithExtension() does $first = $class[0];, which on '' emits Warning: Uninitialized string offset 0. Any application that promotes warnings to exceptions (Laravel's HandleExceptions, for example) then fails.
We hit this in CI: Laravel's Factory::expandAttributes() calls is_callable() on every string attribute, and a randomly generated password starting with \:: (about 1 in a million with Faker's password()) made unrelated tests error out with ErrorException: Uninitialized string offset 0. Fixes are also filed with composer and laravel, but the autoload request for '' looks wrong regardless of who else guards against it.
I am happy to prepare a patch rejecting the empty class name before autoload if you agree this should change.
PHP Version
PHP 8.3.32, 8.4.24, 8.5.9
Operating System
Linux (official php:8.3-cli, php:8.4-cli, php:8.5-cli images)
changed the title [-]is_callable('\::method') asks the autoloader for an empty class name[/-][+]Lone namespace separator asks the autoloader for an empty class name[/+]on Aug 31, 2026
Retitled: is_callable('\::method') is only one entry point. class_exists('\') hits the same zend_lookup_class_ex() path and also autoloads '' — see https://3v4l.org/Qe3u4. Per @Seldaek that is the variant most Composer ClassLoader reports come from.
Activity
[-]is_callable('\::method') asks the autoloader for an empty class name[/-][+]Lone namespace separator asks the autoloader for an empty class name[/+]spawnia commentedon Aug 31, 2026
Retitled:
is_callable('\::method')is only one entry point.class_exists('\')hits the samezend_lookup_class_ex()path and also autoloads''— see https://3v4l.org/Qe3u4. Per @Seldaek that is the variant most ComposerClassLoaderreports come from.#23233 covers both.
Fix GH-23232: lone namespace separator asks the autoloader for an emp…