|
PHP 5 fix...
Hey all,
I've finally had a chance to take a look at the XOOPS source to see what was causing an error in PHP 5. I have PHP 5 RC3 installed on my server. The Xoops install works great, everything was setup smoothly. After setup, that's where the error showed up, right on the main page.
The problem is object cloning. There was no way to truely clone an object in PHP 4, but there is in PHP 5. The &clone() function in the XoopsObject class (file: /html/kernel/object.php, line 528) conflicts with a new reserved word in PHP 5: clone (see http://www.php.net/zend-engine-2.php).
As a quick fix, I simply renamed it to __clone(). This will mean finding all calls to &clone() in all the other files, and replacing them with __clone(). For my install of Xoops, I'll change them as the errors come up... I'm sure once I install some modules, I'll run into the errors, but the basic install hasn't had any problems yet.
As a note, objects can be cloned 2 ways in PHP 5:
Way 1
$obj = new MyClass();
$obj_clone = clone $obj;
Way 2
$obj = new MyClass();
$obj_clone = $obj->__clone();
Xoops should use Way 2, as it will work with PHP 4.
Hope this help those trying to get Xoops to work in PHP 5. I'll be noting all source changes I make as I go along, and I'll post them here, and perhaps on the site I'm working on now which is going to use Xoops.
我的php5环境配xoops就遇到这个问题,可惜英文不行,看不懂!英文好的兄弟帮忙翻译一下!
谢谢! |
|