LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 772|回复: 2

谁英文好,帮忙翻译一下里面的帖子!

[复制链接]
发表于 2004-8-3 18:05:16 | 显示全部楼层 |阅读模式
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就遇到这个问题,可惜英文不行,看不懂!英文好的兄弟帮忙翻译一下!
谢谢!
 楼主| 发表于 2004-8-4 10:14:41 | 显示全部楼层
已经解决了,把object.php, line 528的函数名改一下就行了。

function &clone()改成
function &_clone()
其他什么也不用动,不过调用这个函数的时候就不知道会出现什么情况了,我也懒得去找所有调用这个函数的地方了。
发表于 2004-8-4 12:01:26 | 显示全部楼层

好像是两个下划线吧

__clone()
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表