WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #35013


Ignore:
Timestamp:
12/11/2015 02:36:26 PM (4 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35013 – Description

    initial v1  
    22
    33Here's the problem:
    4 Fatal error: __clone method called on non-object in /var/www/html/lesmenuires/wp-includes/class-wp.php on line 612
     4`Fatal error: __clone method called on non-object in /var/www/html/lesmenuires/wp-includes/class-wp.php on line 612`
    55
    66So I went on having a look at what this function does, and this particular line, here's what I have:
    7 $p = clone $wp_query->post;
     7`$p = clone $wp_query->post;`
    88
    99I've just updated a multi site install to WordPress 4.4, and that is a core WordPress file so you should have the same code than me when looking at this file on the WP4.4 branch.
     
    1212
    1313I've tried a little fix like so:
    14 $p = is_object($wp_query->post) ? clone $wp_query->post : null;
     14`$p = is_object($wp_query->post) ? clone $wp_query->post : null;`
    1515And that fixed my issue. But as this is a WordPress core file, I can't leave it like this that's why I'm reporting this to you today.
    1616
     
    2222
    2323Here's the complete stack trace with comments:
     24{{{
    2425Fatal error: __clone method called on non-object in /var/www/html/lesmenuires/wp-includes/class-wp.php on line 612
    2526Call Stack
     
    30314       0.8151  56045448        WP->main( )     ../functions.php:947
    31325       0.8173  56095592        WP->handle_404( )       ../class-wp.php:677 //Fatal
    32 
     33}}}
    3334Thanking you very much.
    3435
     
    3637
    3738PS: I have echoed a var_dump of $wp_query just before this line to give you a little more context if that's of any help:
    38 
     39{{{
    3940object(WP_Query)[165]
    4041  public 'query_vars' =>
     
    211212    array
    212213      empty
     214}}}