Skip to content
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

AssetManager load empty AssetBundle when register wrong namespace bundle #123

Closed
g-rodigy opened this issue May 19, 2023 · 1 comment · Fixed by #124
Closed

AssetManager load empty AssetBundle when register wrong namespace bundle #123

g-rodigy opened this issue May 19, 2023 · 1 comment · Fixed by #124
Labels

Comments

@g-rodigy
Copy link

What steps will reproduce the problem?

In view files when load asset with wrong namespace.

// @var Yiisoft\Assets\AssetManager $assetManager
$assetManager->register(\wrong\namespace\AppAsset::class);

It happening here loadBundle() ---> AssetUtil::createAsset()
https://github.com/yiisoft/assets/blob/4.0.0/src/AssetLoader.php#L102
https://github.com/yiisoft/assets/blob/4.0.0/src/AssetUtil.php#L44

What is the expected result?

Expected throw exception

What do you get instead?

Got empty instance of AssetBundle

Additional info

Q A
Version 4.0.0
PHP version 8.0
Operating system
@terabytesoftw
Copy link
Member

@g-rodigy I could try this solution thanks, it should work, now the register() and registerMany() methods throw an exception if the class does not exist, instead with registerCustomized(), it supports virtual namespaces.

samdark pushed a commit that referenced this issue May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants