mirror of
https://github.com/Cacti/cacti.git
synced 2026-10-31 00:57:11 +09:00
Fixing #5147 - Language Processing
Error 500 on apache when changing languages
This commit is contained in:
1 parent
24de8ffca0
commit
85c11f54fc
3 files changed
+22
-7
No files matched your search
@@ -57,7 +57,7 @@ Cacti CHANGELOG
|
||||
-issue#5140: Cacti PHP 8.2 SNMP Errors with php-snmp Installed
|
||||
-issue#5142: Correct issues with permission model including display of authorization UI elements and warnings
|
||||
-issue#5143: When a Device has zero Graphs or Data Sources, it does not display the correct value
|
||||
|
||||
-issue#5147: Error 500 on apache when changing languages
|
||||
|
||||
1.2.23
|
||||
-security#4920: Add .htaccess file to scripts folder
|
||||
|
||||
@@ -533,8 +533,15 @@ function __() {
|
||||
$args[0] = __gettext($args[0]);
|
||||
}
|
||||
|
||||
/* process return string against input arguments */
|
||||
return __uf(call_user_func_array('sprintf', $args));
|
||||
$valid_args = array('%%', '%b', '%c', '%d', '%e', '%E', '%f', '%F', '%g', '%G', '%h', '%H', '%o', '%s', '%u', '%x', '%X');
|
||||
|
||||
if (array_search($args[0], $valid_args) !== false) {
|
||||
/* process return string against input arguments */
|
||||
|
||||
return __uf(call_user_func_array('sprintf', $args));
|
||||
} else {
|
||||
return $args[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -6168,8 +6168,10 @@ function CactiErrorHandler($level, $message, $file, $line, $context = array()) {
|
||||
$plugin = (is_array($output_array) && isset($output_array[1]) ? $output_array[1] : '');
|
||||
$error = 'Unknown error occurred';
|
||||
|
||||
if (!empty($phperrors[$level])) {
|
||||
if ($level !== null && isset($phperrors[$level])) {
|
||||
$error = 'PHP ' . $phperrors[$level] . ($plugin != '' ? " in Plugin '$plugin'" : '') . ": $message in file: $file on line: $line";
|
||||
} else {
|
||||
$error = 'PHP Unknown Error' . ($plugin != '' ? " in Plugin '$plugin'" : '') . ": $message in file: $file on line: $line";
|
||||
}
|
||||
|
||||
switch ($level) {
|
||||
@@ -6262,9 +6264,15 @@ function CactiShutdownHandler() {
|
||||
|
||||
$plugin = (isset($output_array[1]) ? $output_array[1] : '');
|
||||
|
||||
$message = 'PHP ' . $phperrors[$error['type']] .
|
||||
($plugin != '' ? " in Plugin '$plugin'" : '') . ': ' . $error['message'] .
|
||||
' in file: ' . $error['file'] . ' on line: ' . $error['line'];
|
||||
if ($error['type'] !== null && isset($phperrors[$error['type']])) {
|
||||
$message = 'PHP ' . $phperrors[$error['type']] .
|
||||
($plugin != '' ? " in Plugin '$plugin'" : '') . ': ' . $error['message'] .
|
||||
' in file: ' . $error['file'] . ' on line: ' . $error['line'];
|
||||
} else {
|
||||
$message = 'PHP Unknown Error' .
|
||||
($plugin != '' ? " in Plugin '$plugin'" : '') . ': ' . $error['message'] .
|
||||
' in file: ' . $error['file'] . ' on line: ' . $error['line'];
|
||||
}
|
||||
|
||||
cacti_log($message, false, 'ERROR');
|
||||
cacti_debug_backtrace('PHP ERROR', false, true, 0, 1);
|
||||
|
||||
Reference in new issue
Block a user