[wp-trac] [WordPress Trac] #32118: SCRIPT_DEBUG check in print_emoji_detection_script() generating PHP Notices

WordPress Trac noreply at wordpress.org
Fri Apr 24 16:04:49 UTC 2015


#32118: SCRIPT_DEBUG check in  print_emoji_detection_script() generating PHP
Notices
--------------------------+-----------------------------
 Reporter:  aut0poietic   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Formatting    |    Version:  4.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Some simple (or poorly built) WordPress themes generate the following PHP
 notice in 4.2:

 Notice: Use of undefined constant SCRIPT_DEBUG - assumed 'SCRIPT_DEBUG' in
 /var/www/html/wordpress/docs.oucpm.org/wp-includes/formatting.php on line
 4144

 In addition to the notice, the emoji script block is printed using the
 expanded (rather than minified) form.

 The Notice is triggered when the active theme does not enqueue any scripts
 (I know, right?).

 Unless added to the config.php, SCRIPT_DEBUG is not defined until a script
 is enqueued (in wp-includes/script-loader.php).

 The the two issues can be resolved by checking to ensure SCRIPT_DEBUG is
 defined ( as is done in other files that use SCRIPT_DEBUG).


 Current:

 {{{
 //wp-includes/formatting.php:4144
 if ( SCRIPT_DEBUG ) {
 ...
 }}}

 Fix:
 {{{
 wp-includes/formatting.php:4144
 if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) {
 ...
 }}}

 Edge case it is, but googling has turned up a pretty sizable chunk of
 these.

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


More information about the wp-trac mailing list