Я работаю стажером, и мне поручили запустить проект на основе PHP с интеграцией Moodle. Я получаю ошибки типа «error/generalExceptionmessage» на локальном хосте во время запуска проекта, хотя я определил местоположение этого кода, я все еще не могу его устранить.
Я работаю стажером, и мне поручили запустить проект на основе PHP с интеграцией Moodle. Я получаю ошибки типа «error/generalExceptionmessage» на локальном хосте во время запуска проекта, хотя я определил местоположение этого кода, я все еще не могу его устранить. [code]function get_exception_info($ex) { global $CFG, $DB, $SESSION;
// Be careful, no guarantee moodlelib.php is loaded. if (empty($module) || $module == 'moodle' || $module == 'core') { $module = 'error'; } // Search for the $errorcode's associated string // If not found, append the contents of $a to $debuginfo so helpful information isn't lost if (function_exists('get_string_manager')) { if (get_string_manager()->string_exists($errorcode, $module)) { $message = get_string($errorcode, $module, $a); } elseif ($module == 'error' && get_string_manager()->string_exists($errorcode, 'moodle')) { // Search in moodle file if error specified - needed for backwards compatibility $message = get_string($errorcode, 'moodle', $a); } else { $message = $module . '/' . $errorcode; $debuginfo .= PHP_EOL.'$a contents: '.print_r($a, true); } } else { $message = $module . '/' . $errorcode; $debuginfo .= PHP_EOL.'$a contents: '.print_r($a, true); }
// Remove some absolute paths from message and debugging info. $searches = array(); $replaces = array(); $cfgnames = array('tempdir', 'cachedir', 'localcachedir', 'themedir', 'dataroot', 'dirroot'); foreach ($cfgnames as $cfgname) { if (property_exists($CFG, $cfgname)) { $searches[] = $CFG->$cfgname; $replaces[] = "[$cfgname]"; } } if (!empty($searches)) { $message = str_replace($searches, $replaces, $message); $debuginfo = str_replace($searches, $replaces, $debuginfo); }
// Be careful, no guarantee weblib.php is loaded. if (function_exists('clean_text')) { $message = clean_text($message); } else { $message = htmlspecialchars($message); }
if (!empty($CFG->errordocroot)) { $errordoclink = $CFG->errordocroot . '/en/'; } else { // Only if the function is available. May be not for early errors. if (function_exists('current_language')) { $errordoclink = get_docs_url(); } else { $errordoclink = 'https://docs.moodle.org/en/'; } }
if (empty($link)) { if (!empty($SESSION->fromurl)) { $link = $SESSION->fromurl; unset($SESSION->fromurl); } else { $link = $CFG->wwwroot .'/'; } }
// When printing an error the continue button should never link offsite. // We cannot use clean_param() here as it is not guaranteed that it has been loaded yet. if (stripos($link, $CFG->wwwroot) === 0) { // Internal HTTP, all good. } else { // External link spotted! $link = $CFG->wwwroot . '/'; }
return $info; } [/code] Это блок кода, выдающий исключение, но я не могу понять, что с этим делать. Я удалил блок, вызывающий эту функцию , но возникли другие ошибки.