Opened 11 years ago
Closed 11 years ago
#25416 closed defect (bug) (fixed)
"Preview Changes" throws a PHP Notice and Warning every second use
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Autosave | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
This is so weird... Every second time I press "Preview Changes" in the page edit admin interface I get these errors instead of the page preview:
Notice: Undefined index: post_excerpt in /var/www/cmstest3/wp-admin/includes/post.php on line 1333 Warning: Cannot modify header information - headers already sent by (output started at /var/www/cmstest3/wp-admin/includes/post.php:1333) in /var/www/cmstest3/wp-includes/pluggable.php on line 875
Using latest WP (3.6.1), standard template (20-13), no plugins activated.
We are running Apache 2 webserver with this PHP on GNU/Linux:
$ php -v PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613/snmp.so' - /usr/lib/php5/20060613/snmp.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP 5.2.4-2ubuntu5.27 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 11 2013 14:13:32) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Attachments (1)
Change History (8)
#2
@
11 years ago
Hmm, I'll try on clean install, too, then (same server configuration as now)
But if it works, that would mean that:
1) disabling all plugins and activating the default template is not enough to report a bug :(
2) the only solution to fix it is making the clean install, which would mean a lot of work and backuping on functional online web :(
Both is very unpleasant.
#3
@
11 years ago
- Keywords has-patch added; reporter-feedback removed
I was able to reproduce this in trunk.
however $new_autosave does contain the post_excerpt field
This is true, except when the current post type does not support excerpts, such as the page post type. I guess with CPT this will also affect the content and title fields, since the first time _wp_post_revision_fields()
returns off of the posted data, but the loop runs on a clean call to _wp_post_revision_fields
, referencing fields that might not exist in $new_autosave
.
It's fairly tricky to reproduce, but give it a shot like this:
- Turn on WP_DEBUG_LOG and watch wp-content/debug.log
- Create a new page, name it "foo", type in "bar" as the content and hit Publish
- Set the content to "bar baz" and hit Preview Changes (don't Publish)
- Set the content back to "bar" and hit Preview Changes again
- See debug.log
Introduced in [24879], suggested fix in 25416.diff. Thoughts on moving this to 3.8.2 or 3.9?
This ticket was mentioned in IRC in #wordpress-dev by kovshenin. View the logs.
11 years ago
#6
@
11 years ago
- Keywords commit added
- Milestone changed from 3.8.2 to 3.9
- Version changed from 3.6.1 to 3.6
25416.diff looks good to me. Not a new regression, let's move to 3.9.
Could not reproduce on a clean install.
The error is coming from
wp_create_post_autosave()
(tags/3.6.1/wp-admin/includes/post.php#L1333), however$new_autosave
does contain thepost_excerpt
field:As far as I can see, this can only happen if a plugin hooked to
_wp_post_revision_fields
filter (tags/3.6.1/wp-includes/revision.php#L9) removespost_excerpt
from the default fields.