Problem in Moodle 1.9 and PHP 5.3

January 2, 2012 | PHP, Technical Stuffs | ,

Today someone ask me to check his Moodle installation in his website. He used to add resource(s) easily in any course he made and lately he’s unable to add any resource. In the resource page, Moodle just displays blank page. No error message at all.

After googling around, I found that the problem is (likely) caused by PHP upgrade from 5.2.x to 5.3.x. And thanks to Andrey who posted a script for a quick hack.

The trick is by adding a new function inside HTML_QuickForm_element class in moodle/lib/pear/HTML/QuickForm/element.php.

< ?php
public function __call($name, $args) {
    $name = str_replace('MoodleQuickForm_', '', $name);
    if ($name == 'passwordunmask') {
        $name = 'password';
    }
    return call_user_func_array(array($this, 'HTML_QuickForm_'.$name), $args);
}
?>

It works like a magic!

1 comment