Skip to content

4.3.3 - Prado::using() loads a namespaced class only an autoloader finds - #1685

Merged
ctrlaltca merged 2 commits into
pradosoft:prado-4.3from
belisoful:4.3-using-autoload
Nov 29, 2026
Merged

ctrlaltca merged 2 commits into
pradosoft:prado-4.3from
belisoful:4.3-using-autoload

Conversation

@belisoful

@belisoful belisoful commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Prado::using(), and so Prado::usingClass(), returned null for a namespaced class that was not loaded yet when no class map entry or path alias named it, such as a class Composer autoloads. A component configured by such a class name was rejected. In pradosoft/prado-rpc, a TRpcService provider given as an application's Composer class failed this way, as did the default Prado\\Web\\Services\\TRpcServer before it was loaded. prado-rpc works around it in pradosoft/prado-rpc#2.

  • After the class map and path alias lookups find nothing, using() loads a namespaced class, interface, or trait through the registered autoloaders. One attempt is made per name: an autoloader loads all three kinds by name.
  • Prado::autoload() calls using(). PHP does not autoload a name again while it is autoloading it, so a name no autoloader finds still returns null without recursion.
  • Tests: a class, an interface, and a trait under the Composer-autoloaded Prado\\Test\\Unit\\Harness\\Autoload namespace that nothing loads earlier. There are also tests for an unknown name through autoload() and for a directory namespace without *. The three load tests fail without the fix.
  • HISTORY.md entry.

The same fix for 4.4 is #1686 on master. Checked: php-cs-fixer, PHPStan, and the unit suite pass (8593 tests).

@belisoful

Copy link
Copy Markdown
Member Author

This is an important fix for 4.3.3.

@ctrlaltca
ctrlaltca merged commit 4d9c077 into pradosoft:prado-4.3 Nov 29, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants