ID:               39381
 User updated by:  tikitiki at mybboard dot com
-Reported By:      rygorde4 at sbcglobal dot net
+Reported By:      tikitiki at mybboard dot com
 Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: Not Applicable
 PHP Version:      5.2.0
 New Comment:

C'mon Guys... Hear me out here.

The classes in PHP 5.2.0 have been changed to destruct in the reverse
order that they've been initialized. Why I ask? I hope the change was
not 'just because'. And if the change was intentional, you guys should
have known that it would affect many scripts. Does it not make more
sense to destruct classes in the order they were initialized in the
first place?


Previous Comments:
------------------------------------------------------------------------

[2006-11-12 16:57:38] rygorde4 at sbcglobal dot net

this is a PHP 5.2.0 error which causes the classes to be destructed in
the reverse way they are initialized. If this change was intended for
PHP 5.2.0, then you should have given us a heads up before you went
releasing software that broke a whole ton of scripts.
This IS a error on PHP 5.2.0, the PHP team should consider unbogusing
the report.

------------------------------------------------------------------------

[2006-11-11 00:58:58] rygorde4 at sbcglobal dot net

http://bugs.php.net/bug.php?id=36759 ???

How come it is different in PHP 5.2.0? A lot of programs are corrupt
because of this 'change'.

Will being able to call register_shutdown_function on __destruct fix
this, regardless of php version?

------------------------------------------------------------------------

[2006-11-10 16:15:58] [EMAIL PROTECTED]

There is no certain order of object destruction, there never was and
this is explained in many other reports.
You have to take care of the correct destruction order yourself.

------------------------------------------------------------------------

[2006-11-10 16:08:11] tikitiki at mybboard dot com

Reproduce code:
---------------
<?php
function run_shutdown() {
        global $x;
        echo __FUNCTION__."\n";
        $x->do_something();
}

class Foo {
  function do_something() {
    echo "hi\n";
  }
  function __destruct() {
    echo __METHOD__."\n";    
  }
}

class Bar {
  
  function __destruct() {
    run_shutdown();
    echo __METHOD__."\n";
  }
}
$y = new Bar();
$x = new Foo();
?>

Expected result:
----------------
Bar::__destruct
run_shutdown
hi
Foo::__destruct

Actual result:
--------------
Foo::__destruct 
run_shutdown
Fatal error: Call to a member function do_something() on a non-object
in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\test.php on line 5

------------------------------------------------------------------------

[2006-11-09 02:37:47] Nikolas dot hagelstein at gmail dot com

Same at wordpress 2.05 using php5.2:
 PHP Fatal error:  Call to a member function get() on a non-object in
/var/www/www.trashboard.de/htdocs                     
/wp-includes/cache.php on line 28
Reverting to 5.1.6 made it work again

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/39381

-- 
Edit this bug report at http://bugs.php.net/?id=39381&edit=1

Reply via email to