This is a strange problem for two reasons:
1) It occurs on some Moodle servers and not on others. I've got two instance of Moodle running out of the same repository, one of them remotely and the other one locally. The server settings differ slightly, but for some reason, on the local instance I do not get the error but on the remote instance I do.
2) Also strange because the "Choose or upload a file..." button gets generated exactly the same way ( addElement() -> updateAttributes($buttonattributes) ) yet it works just fine while the websearch one does not.
However, neither generate by the method I personally prefer, the one that gets used in course/edit_form.php, where it feeds the attributes directly into the addElement() parameter rather than assigning them after-the-fact. As I knew this method operated as expected, I switched the way the addElement on line 631 worked to the latter method - it now works as intended.
Replace lines 630 - 634:
if (!empty($CFG->resource_websearch)) {
$searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource').'...');
$buttonattributes = array('title'=>get_string('localfilechoose', 'resource'), 'onclick'=>"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');");
$searchbutton->updateAttributes($buttonattributes);
}
With these lines:
if (!empty($CFG->resource_websearch)) {
$searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource'), array('title'=>get_string('searchweb', 'resource'), 'onclick'=>"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');"));
}
In the long run, it might be worth it to consider if this button really adds any functionality. It seems mostly superfluous, especially as it doesn't provide a means of capturing a URL without having to do copy + paste. Moodle also doesn't present admins with the ability to change the search engine used, counterintuitive to the rest of the way the system seems to operate.
Works fine for me in latest 1.8+ in FF, Konqueror, IE and Opera.