Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mantisbt/mantisbt
base: 4c4f1bc3cab7
...
head fork: mantisbt/mantisbt
compare: 6986a7364659
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 18 additions and 7 deletions.
  1. +17 −6 core/error_api.php
  2. +1 −1  lang/strings_english.txt
View
23 core/error_api.php
@@ -402,11 +402,22 @@ function error_build_parameter_string( $p_param, $p_showtype = true, $p_depth =
function error_string( $p_error ) {
global $g_error_parameters;
- $t_err_msg = lang_get( 'MANTIS_ERROR' );
- if( array_key_exists( $p_error, $t_err_msg) ) {
- $t_error = $t_err_msg[$p_error];
- } else {
- return lang_get( 'missing_error_string' ) . $p_error;
+ $t_lang = null;
+ while( true ) {
+ $t_err_msg = lang_get( 'MANTIS_ERROR', $t_lang );
+ if( array_key_exists( $p_error, $t_err_msg) ) {
+ $t_error = $t_err_msg[$p_error];
+ break;
+ } elseif( is_null( $t_lang ) ) {
+ # Error string not found, fall back to English
+ $t_lang = 'english';
+ } else {
+ # Error string not found
+ $t_error = lang_get( 'missing_error_string' );
+ # Prepend the error number
+ array_unshift( $g_error_parameters, $p_error );
+ break;
+ }
}
# We pad the parameter array to make sure that we don't get errors if
@@ -414,7 +425,7 @@ function error_string( $p_error ) {
$t_padding = array_pad( array(), 10, '' );
# ripped from string_api
- $t_string = call_user_func_array( 'sprintf', array_merge( array( $t_error ), $g_error_parameters, $t_padding ) );
+ $t_string = vsprintf ( $t_error, array_merge( $g_error_parameters, $t_padding ) );
return preg_replace( "/&(#[0-9]+|[a-z]+);/i", "&$1;", @htmlspecialchars( $t_string, ENT_COMPAT, 'UTF-8' ) );
}
View
2  lang/strings_english.txt
@@ -1559,7 +1559,7 @@ $s_month_december = 'December';
/**
* ERROR strings
*/
-$s_missing_error_string = 'Missing Error String: ';
+$s_missing_error_string = 'Missing Error String: %1$s';
$MANTIS_ERROR[ERROR_GENERIC] = 'An error occurred during this action. You may wish to report this error to your local administrator.';
$MANTIS_ERROR[ERROR_SQL] = 'SQL error detected.';

No commit comments for this range

Something went wrong with that request. Please try again.