[wp-trac] Re: [WordPress Trac] #3267: PHP Error in template-functions-links.php

WordPress Trac wp-trac at lists.automattic.com
Sat Oct 21 13:20:06 GMT 2006


#3267: PHP Error in template-functions-links.php
-------------------------+--------------------------------------------------
 Reporter:  Mike_Koepke  |        Owner:  markjaquith
     Type:  defect       |       Status:  assigned   
 Priority:  high         |    Milestone:  2.0.5      
Component:  General      |      Version:  2.0.4      
 Severity:  normal       |   Resolution:             
 Keywords:               |  
-------------------------+--------------------------------------------------
Changes (by Denis-de-Bernardy):

  * component:  Template => General

Comment:

 $wp_rewrite and other WP objects get destroyed before the shutdown hook is
 called, because they are created as follows:

 $wp_query   = new WP_Query();
 $wp_rewrite = new WP_Rewrite();
 $wp         = new WP();

 I've filed a bug or two related to this in the past, but they never were
 taken into account. To fix, replace the above with the following in wp-
 settings.php:

 $wp_query   =& new WP_Query();
 $wp_rewrite =& new WP_Rewrite();
 $wp         =& new WP();

 This extends the life of these objects to _after_ the shutdown hook is
 called.

 Denis

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3267#comment:2>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list