|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-11-04 19:18 UTC] tikitiki at mybboard dot com
Description: ------------ If functions are called within __destruct without register_shutdown_function being called on __destruct within a class, and global variables that are classes will not work. This is a bug specificly with PHP 5.2.0. This bug was reported multiple times at my discussion system (here http://community.mybboard.net/showthread.php?tid=13506 and here http://community.mybboard.net/showthread.php?tid=12430). Calling register_shutdown_function on __destruct, I was able to use that as a workaround, but the problem remains with __destruct. Please contact me with any information you need, and I will gladly assist you. Reproduce code: --------------- You can install a fresh version of MyBB 1.2 here: http://mybboard.com/downloads.php using PHP 5.2.0. The problems lay in inc/class_core.php Expected result: ---------------- No error, shutdown functions should run properly Actual result: -------------- Fatal error: Call to a member function run_hooks() on a non-object in /www/xxx/pub/inc/functions.php on line 146 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 18:00:02 2025 UTC |
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