Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#53566 new defect (bug)

Pass the asset path to the `_doing_it_wrong()` notice in `register_block_script_handle()`

Reported by: desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Script Loader Keywords: good-first-bug
Focuses: Cc:


The _doing_it_wrong() notice in register_block_script_handle() provides the metadata field name and block name when the requested asset does not exist, but not the path of where the asset is expected to be. Adding the value passed to realpath() could be helpful to debug why the file is considered non-existent.

Also, the conditional surrounding the _doing_it_wrong() notice is a ! file_exists() check. However, the path used to check for the file is passed through realpath() before, which will be false if the file does not exist. The file_exists() check could be removed in favor of a false !== $script_asset_path check.

Related #53565.

Change History (1)

#1 @desrosj
5 weeks ago

  • Summary changed from Include the asset path to the `_doing_it_wrong()` notice in `register_block_script_handle()` to Pass the asset path to the `_doing_it_wrong()` notice in `register_block_script_handle()`
Note: See TracTickets for help on using tickets.