[wp-trac] [WordPress Trac] #51219: Theme editor page showing undefined variable notice

WordPress Trac noreply at wordpress.org
Wed Sep 2 15:57:47 UTC 2020


#51219: Theme editor page showing undefined variable notice
-----------------------------+-----------------------------
 Reporter:  vinayak.anivase  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Administration   |    Version:  5.5.1
 Severity:  normal           |   Keywords:  dev-feedback
  Focuses:  administration   |
-----------------------------+-----------------------------
 The theme editor ('wp-admin/theme-editor.php') page showing a "Undefined
 variable: error" notice for a fresh installation.

 After checking the 'theme-editor.php' file, I found that the error
 variable used on line number 159 and 277 is not defined except on line
 number 153, where it is defined inside an 'if' conditional block.

 {{{#!php
 <?php
 if ( ! is_file( $file ) ) {
         $error = true;
 }
 }}}


 The variable should be initialized prior to line number 152:

 {{{#!php
 <?php
 $error = false;
 if ( ! is_file( $file ) ) {
         $error = true;
 }
 }}}

 To recreate the issue, please enable debug mode and visit 'wp-admin/theme-
 editor.php' page.

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


More information about the wp-trac mailing list