#39767 closed enhancement (invalid)
wp-admin failures upon line breaks in functions.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7.2 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
Building a child theme I came accross something I'd consider a bug:
In wp-admin the media editor for image resizing & cropping didn't load preview images and failed to edit uploaded images. I did some research on the web and found a forum posting (on some site) pointing out an issue that occures when there are line breaks or spaces between closing and opening PHP tags ("...?> \n <?php...") in functions.php or any required / included php-files (in my case a file called classes.php which is required in functions.php ending with two line breaks after the final closing ?>). Only after eliminating those line breaks / spaces my child theme's media editor (for resizing & cropping) worked again.
It would be some enhancement fixing this bug and saving developers who are not aware of that issue lots and lots of time researching and finding the solution.
Hey there,
Welcome to WordPress Trac!
Whitespace after closing PHP tags causing all sorts of weirdness is not a bug in WordPress, but simply how PHP works. From the PHP website:
If your theme or plugin has line breaks after
?>
, you need to inform the developer to fix this (ideally by omitting the closing tag at the end of the file). Again, since this is how PHP is designed, WordPress cannot account for this.