[wp-trac] [WordPress Trac] #42609: Regression: WordPress 4.9 plugin/theme editor cannot edit files when running on a Windows based server

WordPress Trac noreply at wordpress.org
Fri Nov 17 21:00:36 UTC 2017


#42609: Regression: WordPress 4.9 plugin/theme editor cannot edit files when
running on a Windows based server
--------------------------+-----------------------------
 Reporter:  Otto42        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  4.9
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 The new ajax based editor in WordPress 4.9 calls the new
 wp_edit_theme_plugin_file function to perform the file edit.

 On Windows based servers, this function fails in the call to
 validate_file, because Windows based machines will have filenames like the
 following sent to it:

 C:\xampp\htdocs\wptrunk/wp-content/themes/twentyseventeen/style.css

 The validate file function returns 2 because of the colon in the second
 character slot.

 This worked in 4.8.3 because the editing code did not call
 validate_file(), it called validate_file_to_edit(), which in turn calls
 validate_file() but then ignores the "2" response from it.

 Both the plugin and theme editor interfaces call the
 validate_file_to_edit() function, it's simply the new ajax code that is
 calling validate_file() directly.

 Replacing validate_file with validate_file_to_edit in
 wp_edit_theme_plugin_file() should fix the issue.

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


More information about the wp-trac mailing list