[wp-trac] [WordPress Trac] #59475: 6.4 beta 1: Function WP_Scripts::add_data was called incorrectly.

WordPress Trac noreply at wordpress.org
Fri Sep 29 13:14:10 UTC 2023


#59475: 6.4 beta 1: Function WP_Scripts::add_data was called incorrectly.
--------------------------+---------------------------
 Reporter:  kebbet        |       Owner:  spacedmonkey
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  6.4
Component:  Editor        |     Version:  trunk
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56744" 56744]:
 {{{
 #!CommitTicketReference repository="" revision="56744"
 Editor: Avoid Deferring Loading for Empty Block Script URI

 In the context of register_block_script_handle, the get_block_asset_url
 function may return false when an empty string is provided as the input.
 This behavior is intended to prevent the generation of invalid URLs.
 However, when the script loading strategy is set to "defer" while passing
 false, it triggers a "doing it wrong" message.

 This situation becomes problematic, especially for scenarios where the
 scripts haven't been built yet. In such cases, the realpath call returns
 an empty string because the file doesn't exist. To address this issue, we
 now perform a simple check to ensure that the script URI is not empty
 before applying the "defer" loading strategy. This adjustment prevents
 unnecessary deferral of loading for scripts with empty URIs.

 Follow on from [56683] and [56033].

 Props kebbet, mukesh27, swissspidy, westonruter, spacedmonkey.
 Fixes #59475
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59475#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list