Skip to content

ext/spl: ignore leading namespace separator in spl_autoload()#22323

Merged
Girgias merged 1 commit into
php:PHP-8.4from
jorgsowa:fix/spl-autoload-leading-backslash
Jun 24, 2026
Merged

ext/spl: ignore leading namespace separator in spl_autoload()#22323
Girgias merged 1 commit into
php:PHP-8.4from
jorgsowa:fix/spl-autoload-leading-backslash

Conversation

@jorgsowa

@jorgsowa jorgsowa commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Extracted from #22260

Strip a leading "\" before lowercasing, mirroring zend_lookup_class_ex(), so both spellings resolve identically.

Closes #22322

@jorgsowa jorgsowa requested a review from Girgias as a code owner June 15, 2026 21:25
@jorgsowa jorgsowa changed the base branch from master to PHP-8.4 June 15, 2026 21:28
Strip a leading "\\" before lowercasing, mirroring zend_lookup_class_ex(),
so both spellings resolve identically.
@jorgsowa jorgsowa force-pushed the fix/spl-autoload-leading-backslash branch from a5d34ed to 66bfd18 Compare June 16, 2026 22:11
@Girgias

Girgias commented Jun 18, 2026

Copy link
Copy Markdown
Member

Does this really need to be backported tho?

@jorgsowa

Copy link
Copy Markdown
Contributor Author

I'm following this approach for all bugs.
#22272 (comment)

I'm simple bug fixer, I do what more experienced folks tell me to do. If you want me to point to master I can do it.

@Girgias

Girgias commented Jun 24, 2026

Copy link
Copy Markdown
Member

No my bad, targetting 8.4 makes sense, we usually just target master for fuzzer fixes, but this is kinda legit.

@Girgias Girgias merged commit 66910ee into php:PHP-8.4 Jun 24, 2026
18 checks passed
Girgias added a commit that referenced this pull request Jun 24, 2026
* PHP-8.5:
  NEWS entries for recent SPL bug fixes
  ext/spl: ignore leading namespace separator in spl_autoload() (#22323)
  ext/spl: fix class_parents for classes with leading slash in non-autoload mode (#22283)
hariuc pushed a commit to hariuc/php-src that referenced this pull request Jun 24, 2026
* PHP-8.4:
  NEWS entries for recent SPL bug fixes
  ext/spl: ignore leading namespace separator in spl_autoload() (php#22323)
  ext/spl: fix class_parents for classes with leading slash in non-autoload mode (php#22283)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spl_autoload() fails to load class with leading \

2 participants