I'm farely new to Moodle and just experimenting with it (to see if we can use it), but when I make a question for a quiz and I want to preview it it returns an error:
Fatal error: Call to undefined function: clone() in [...]\moodle\mod\quiz\locallib.php on line 1226
I just downloaded the latest 1.5dev version today. There are more occurences of clone() in that file.
Regards, Chris
clone() should be defined in lib/moodlelib.php for PHP4 (and is native in PHP5) .... what exact version of PHP are you using?
if(!check_php_version('5.0.0')) {
eval('
function clone($obj) {
return $obj;
}
');
}
if(!check_php_version('5.0.0')) {
eval('
function clone($obj) {
return $obj;
}
');
}
In reply to Martin Dougiamas
Re: Undefined clone() function in locallib.php
by Zbigniew Fiedorowicz -
Perhaps some installations have eval disabled for security reasons? See the following post:
http://moodle.org/mod/forum/discuss.php?d=23288&parent=110619
http://moodle.org/mod/forum/discuss.php?d=23288&parent=110619
In reply to Zbigniew Fiedorowicz
Re: Undefined clone() function in locallib.php
by John Papaioannou -
As far as I can remember, if you disable eval(), then Blocks won't work. So it's not that, probably.
I think I have found the little bugger. My php version is 4.3.10. Here the function check_php_version in lib/moodlelib.php (line 4870) comes to nothing: it returns (4310 >= 500) and that of course is true. So moodle thinks I have a version higher than 5.0.0, which is not the case. Should I file a bug report? (If so, where and how?)
Regards, Chris
Regards, Chris
Yes, you found the bug . It was fixed in CVS yesterday. The bug tracker you can find at bugs.moodle.org
Hi Chris,
I received basically the same error and posted it in the bug tracker (bug 3176).
I received back a request to modify a few things and will do so after my 11:20 class (Atlantic Daylight Time, GMT -3) and retry. I will post the results. It should be in a couple of hours.
Jim
Hi Chris,
As a follow-up, I was advised to change moodlelib.php (in the lib folder).
From:
if(!check_php_version('5.0.0')) {
// the eval is needed to prevent PHP 5 from
getting a parse error!
eval('
function clone($obj) {
return
$obj;
}
');
}
To:
function clone($obj) {
return
$obj;
}
It worked
Thanks to the Moodle team,
Jim
As a follow-up, I was advised to change moodlelib.php (in the lib folder).
From:
if(!check_php_version('5.0.0')) {
// the eval is needed to prevent PHP 5 from
getting a parse error!
eval('
function clone($obj) {
return
$obj;
}
');
}
To:
function clone($obj) {
return
$obj;
}
It worked
Thanks to the Moodle team,
Jim