From: tjhunt Date: Tue, 3 Apr 2007 08:34:39 +0000 (+0000) Subject: Better way to detect whether a function exists in this version of PHP before redefini... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5081e0a635ad3bae93f63ab32dddd9f95cd37b47;p=moodle.git Better way to detect whether a function exists in this version of PHP before redefining it. --- diff --git a/lib/weblib.php b/lib/weblib.php index 45d7d2ecb1..36b2c71d0b 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -4981,7 +4981,7 @@ function notice_yesno ($message, $linkyes, $linkno, $optionsyes=NULL, $optionsno * Provide an definition of error_get_last for PHP before 5.2.0. This simply * returns NULL, since there is not way to get the right answer. */ -if (!version_compare(phpversion(), '5.2.0') >= 0) { +if (!function_exists('error_get_last')) { // the eval is needed to prevent PHP 5.2+ from getting a parse error! eval(' function error_get_last() {