black-studio / black-studio-tinymce-widget

Black Studio TinyMCE Widget plugin for WordPress
https://wordpress.org/plugins/black-studio-tinymce-widget/
GNU General Public License v3.0
22 stars 13 forks source link

PHP notice #31

Closed cfoellmann closed 9 years ago

cfoellmann commented 9 years ago

Following PHP notice (VVV; php 5.5.x):

Notice
Trying to get property of non-object    

1

wp-includes/class-wp-editor.php:1255

_WP_Editors::wp_fullscreen_html()
_WP_Editors::editor_js()
do_action('admin_print_footer_scripts')

Core

@marcochiesi you should have a look at https://wordpress.org/plugins/query-monitor/

marcochiesi commented 9 years ago

This seems to be a WP core issue. It looks like that the function that outputs stuff for the fullscreen mode expects a $post to be defined (returned by get_post), but when using the editor in widgets page, no $post is defined.

The fix is quite easy: change the wp-includes/class-wp-editor.php:1253 from <?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?> to <?php if ( $post && $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?>

I suppose this should be reported to WP core bug tracker. What do you think?

marcochiesi commented 9 years ago

P.s. Thanks for pointing me to Query Monitor plugin. I usually was debugging with Debug Bar + Debug Bar Extender, but at first sight this one looks better.

cfoellmann commented 9 years ago

It is better ;-) Open an issue on trac when you got the time. Add a path for core if you have a solution! Try searching a bit if it is already reported. I reported a few duplicates in the past :-(

marcochiesi commented 9 years ago

Opened ticket.

marcochiesi commented 9 years ago

This issue was fixed in WordPress core, so it can be closed.