[wp-trac] [WordPress Trac] #46637: Corrupted functions.php file after editing in built-in theme editor

WordPress Trac noreply at wordpress.org
Mon Mar 25 11:32:11 UTC 2019


#46637: Corrupted functions.php file after editing in built-in theme editor
----------------------------+-----------------------------
 Reporter:  SergeyBiryukov  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Themes          |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 Got
 [https://ru.wordpress.org/support/topic/%d0%bf%d1%80%d0%be%d0%bf%d0%b0%d0%bb-%d1%80%d0%b5%d0%b4%d0%b0%d0%ba%d1%82%d0%be%d1%80/#post-318693
 at least two reports] of the following scenario.

 When editing the `functions.php` file of a  theme, WordPress says: "Unable
 to communicate back with site to check for fatal errors, so the PHP change
 was reverted." However, the reverted file has 0 bytes length, and has to
 be recovered from a backup copy.

 From what I can see, this can only happen in two cases:
 * [https://core.trac.wordpress.org/browser/tags/5.1.1/src/wp-
 admin/includes/file.php?marks=474#L473 file_get_contents()] could not
 properly read the file contents.
 * The file is writable and
 [https://core.trac.wordpress.org/browser/tags/5.1.1/src/wp-
 admin/includes/file.php?marks=485#L474 fwrite()] succeeded, but
 [http://core.trac.wordpress.org/browser/tags/5.1.1/src/wp-
 admin/includes/file.php?marks=588#L585 file_put_contents()] did not.

 Don't have any more details at this point, created the ticket as a
 reference for investigation.

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


More information about the wp-trac mailing list