Opened 13 years ago
Closed 13 years ago
#24477 closed defect (bug) (invalid)
_wp_preview_meta_filter should check if $post is empty
| Reported by: | itthinx | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Revisions | Version: | 3.6 |
| Severity: | minor | Keywords: | |
| Cc: | Focuses: |
Description
The filter misses to check for empty( $post ) which can lead to problems when get_post_meta() is called during preview.
Here is an example where this happens (note that in this example the Groups plugin is involved, but the issue is not dependent on the plugin) :
PHP Notice: Trying to get property of non-object in /var/www/groups-newsletters/wp-includes/revision.php on line 543
[01-Jun-2013 13:27:37] PHP Stack trace:
[01-Jun-2013 13:27:37] PHP 1. {main}() /var/www/groups-newsletters/index.php:0
[01-Jun-2013 13:27:37] PHP 2. require() /var/www/groups-newsletters/index.php:17
[01-Jun-2013 13:27:37] PHP 3. wp() /var/www/groups-newsletters/wp-blog-header.php:14
[01-Jun-2013 13:27:37] PHP 4. WP->main() /var/www/groups-newsletters/wp-includes/functions.php:779
[01-Jun-2013 13:27:37] PHP 5. WP->query_posts() /var/www/groups-newsletters/wp-includes/class-wp.php:549
[01-Jun-2013 13:27:37] PHP 6. WP_Query->query() /var/www/groups-newsletters/wp-includes/class-wp.php:485
[01-Jun-2013 13:27:37] PHP 7. WP_Query->get_posts() /var/www/groups-newsletters/wp-includes/query.php:2985
[01-Jun-2013 13:27:37] PHP 8. apply_filters_ref_array() /var/www/groups-newsletters/wp-includes/query.php:2785
[01-Jun-2013 13:27:37] PHP 9. call_user_func_array() /var/www/groups-newsletters/wp-includes/plugin.php:230
[01-Jun-2013 13:27:37] PHP 10. Groups_Post_Access::the_posts() /var/www/groups-newsletters/wp-includes/plugin.php:0
[01-Jun-2013 13:27:37] PHP 11. Groups_Post_Access::user_can_read_post() /var/www/groups-newsletters/wp-content/plugins/groups/lib/access/class-groups-post-access.php:192
[01-Jun-2013 13:27:37] PHP 12. Groups_Post_Access::get_read_post_capabilities() /var/www/groups-newsletters/wp-content/plugins/groups/lib/access/class-groups-post-access.php:360
[01-Jun-2013 13:27:37] PHP 13. get_post_meta() /var/www/groups-newsletters/wp-content/plugins/groups/lib/access/class-groups-post-access.php:341
[01-Jun-2013 13:27:37] PHP 14. get_metadata() /var/www/groups-newsletters/wp-includes/post.php:1715
[01-Jun-2013 13:27:37] PHP 15. apply_filters() /var/www/groups-newsletters/wp-includes/meta.php:274
[01-Jun-2013 13:27:37] PHP 16. call_user_func_array() /var/www/groups-newsletters/wp-includes/plugin.php:173
[01-Jun-2013 13:27:37] PHP 17. _wp_preview_meta_filter() /var/www/groups-newsletters/wp-includes/plugin.php:0
Attachments (1)
Change History (3)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This patch adds the empty( $post ) check to the filter.