[wp-trac] [WordPress Trac] #11518: Fatal error: Call to undefined method WP_Error::__destruct()

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 24 13:35:46 UTC 2009


#11518: Fatal error: Call to undefined method WP_Error::__destruct()
----------------------------+-----------------------------------------------
 Reporter:  westi           |        Owner:        
     Type:  defect (bug)    |       Status:  closed
 Priority:  normal          |    Milestone:  2.9.1 
Component:  Administration  |      Version:  2.9   
 Severity:  normal          |   Resolution:  fixed 
 Keywords:                  |  
----------------------------+-----------------------------------------------

Comment(by hakre):

 Replying to [comment:23 miqrogroove]:
 > It is standard practice to explicitly call constructors and destructors
 whenever needed in those situations.

 Just to add a counter-point from the other direction:

 It is bad practice to use the magic function {{{__destruct()}}} for any
 other purpose than the intended one.

 In this case, it's not the propper function name even if the name somehow
 seems fitting. That's important because we have a misuse in simplepie
 here. As written, it should be replaced with some other named function
 (maybe {{{destroy()}}}?) to correct this. The magic function
 {{{__destruct()}}} is not designed to clean up circular references.

 To close the circle: The intention is correct that self-references need to
 be destroyed (otherwise the memory would stay in use with PHP, even as
 well in 5.3 see below). The current implementation factually does this but
 the pseudo-''destructor'' function has the wrong name.

 ----

 Just to show that it's a feature not a bug with 5.3 (while digging into
 this and in case that's usefull background information for any dev here),
 there is actually need to enable garbage collection for circular
 references because it's optional. It's the
 [http://www.php.net/manual/en/function.gc-enable.php gc_enable function].
 Introduced in [http://php.net/ChangeLog-5.php#5.3.0 5.3.0 30-June-2009].

 ----

 Regarding SimplePie fixes, in #11219 we do not do any upstream for
 simplepie any longer.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11518#comment:24>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list