[wp-trac] [WordPress Trac] #46089: Memory exhaustion when setting script translations on `wp-i18n`

WordPress Trac noreply at wordpress.org
Thu Jan 24 00:47:26 UTC 2019


#46089: Memory exhaustion when setting script translations on `wp-i18n`
---------------------------+-----------------------------
 Reporter:  aduth          |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Script Loader  |    Version:
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 A memory exhaustion occurs given the following snippet of code:

 {{{#!php
 <?php
 add_action( 'admin_enqueue_scripts', function() {
         wp_set_script_translations( 'wp-i18n', '' );
 } );
 }}}


 {{{
 <b>Fatal error</b>:  Allowed memory size of 268435456 bytes exhausted
 (tried to allocate 262144 bytes) in <b>/srv/www/editor/htdocs/wp-
 includes/class.wp-dependencies.php</b> on line <b>324</b><br />
 }}}


 Memory exhaustion occurs here:

 https://github.com/WordPress/WordPress/blob/4e3e9ca9cf893190609728848caf224034fd1ef0
 /wp-includes/class.wp-dependencies.php#L338

 I think it stems from this line:

 https://github.com/WordPress/WordPress/blob/4e3e9ca9cf893190609728848caf224034fd1ef0
 /wp-includes/class.wp-scripts.php#L517

 Where `wp-i18n` is adding itself as a dependency.

 Could probably do for a simple check to ensure that the incoming handle is
 not `wp-i18n`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46089>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list