WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#17874 closed defect (bug) (fixed)

Warning if TinyMCE isn't used for posts

Reported by: SidHarrell Owned by: azaozz
Milestone: 3.2 Priority: normal
Severity: trivial Version: 3.2
Component: Editor Keywords: has-patch
Focuses: Cc:
PR Number:

Description

Notice: Trying to get property of non-object in /home/sidney/www/wordpress_trunk/wp-admin/includes/post.php on line 1760

Attachments (1)

diffpatch (886 bytes) - added by SidHarrell 8 years ago.
my hackish attempt. How do the pros do it?

Download all attachments as: .zip

Change History (14)

@SidHarrell
8 years ago

my hackish attempt. How do the pros do it?

#1 @westi
8 years ago

How do I reproduce this Notice?

#2 @nacin
8 years ago

Looks like a plugin butchering the $post global.

#3 @ocean90
8 years ago

  • Keywords reporter-feedback added

#4 @SidHarrell
8 years ago

I'm a (new) developer working on the Event Espresso plugin, so I have EE trunk installed. I was going through suppressing php warnings coming from EE when I found this.
@ Mr. Nacin
Does that mean we are doing something to unset that field of the global. I will check it out and get back to you. Thanks for your time.

#5 @SidHarrell
8 years ago

I've been killing myself trying to figure out where Event Espresso would be setting the global $post to NULL (what is it at the breakpoint I set on line 1760) There is only one file where we use the global $post, and I set breakpoints at the three spots in that file where it's declared, and when it didn't hit any of them, I renamed the file and no effect. So I declared global $post at the top of admin.php so I could watch it (I tried setting a watch on it first) and it never gets set to anything (stays NULL) throughout execution. I'm going to the plugin settings page, so it's http://localhost/wordpress_trunk/wp-admin/admin.php?page=event_espresso
When I go to another plugin settings page that doesn't give the notice, it's because it never gets to post.php line 1760.
Here's the call stack on the notice. Note the event espresso is calling wp_tiny_mce() in /wp-admin/includes/post.php:1711

Call Stack: 0.0120 681896

  1. {main}() /var/www/wordpress_trunk/wp-admin/index.php:0 0.0134 812712
  2. require_once('/var/www/wordpress_trunk/wp-admin/admin.php') /var/www/wordpress_trunk/wp-admin/index.php:10 0.4190 40215840
  3. do_action() /var/www/wordpress_trunk/wp-admin/admin.php:155 0.4191 40218040
  4. call_user_func_array() /var/www/wordpress_trunk/wp-includes/plugin.php:405 0.4191 40218096
  5. organization_config_mnu() /var/www/wordpress_trunk/wp-includes/plugin.php:0 0.4191 40218768
  6. wp_tiny_mce() /var/www/wordpress_trunk/wp-content/plugins/event-espresso/includes/organization_config.php:8 0.4217 40241584
  7. do_action() /var/www/wordpress_trunk/wp-admin/includes/post.php:1711 0.4217 40243632
  8. call_user_func_array() /var/www/wordpress_trunk/wp-includes/plugin.php:405 0.4217 40243688
  9. wp_preload_dialogs() /var/www/wordpress_trunk/wp-includes/plugin.php:0 0.4314 40304264
  10. wp_fullscreen_html() /var/www/wordpress_trunk/wp-admin/includes/post.php:1732

#6 @SidHarrell
8 years ago

  • Keywords reporter-feedback removed

#7 @ocean90
8 years ago

  • Component changed from General to Editor
  • Milestone changed from Awaiting Review to 3.2
  • Summary changed from php warning to Warning if TinyMCE isn't used for posts

#8 @ocean90
8 years ago

So the problem is the new fullscreen mode. It has the "Save" button, but if you use wp_tiny_mce() outside the edit screen, for example for plugins like Event Espresso you will get the warning. We should disable the fullscreen mode then.

In your case wp_tiny_mce( $teeny = true ) would be better too.

Last edited 8 years ago by ocean90 (previous) (diff)

#9 @ocean90
8 years ago

  • Owner set to azaozz
  • Status changed from new to reviewing

#10 follow-up: @SidHarrell
8 years ago

Sorry, the stack trace didn't show the arguments we're passing:

wp_tiny_mce( false , // true makes the editor "teeny"
		array(
			"editor_selector" => "theEditor"//This is the class name of your text field
		)
	);}}}
Last edited 8 years ago by SidHarrell (previous) (diff)

#11 @azaozz
8 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In [18331]:

Fix warning when DFW is loaded and the $post global is not set, props SidHarrell, fixes #17874

#12 in reply to: ↑ 10 @azaozz
8 years ago

Replying to SidHarrell:

As @ocean90 points out above, it's probably better to use the 'teeny' mode of the editor (it doesn't include DFW).

#13 @SidHarrell
8 years ago

Thanks, I'll let Seth know.

Note: See TracTickets for help on using tickets.