Skip to content

Commit

Permalink
Fix 'Undefined variable' PHP notice in API REST
Browse files Browse the repository at this point in the history
Since the Slim Container's 'displayErrorDetails' setting is set to true
according to $t_show_detailed_errors's value, instead of referencing the
variable directly within the closure via a 'use' statement, we retrieve
the Container's settings to determine whether PHP exception details
should be shown or not.

Remove $t_show_detailed_errors variable as it is no longer needed.

Regression introduced by b2119ce.

Fixes #25429
  • Loading branch information
dregad committed Feb 3, 2019
1 parent 7d5c990 commit af72555
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/rest/index.php
Expand Up @@ -46,8 +46,7 @@
# Show SLIM detailed errors according to Mantis settings
$t_config = array();

$t_show_detailed_errors = ON == config_get_global( 'show_detailed_errors' );
if( $t_show_detailed_errors ) {
if( ON == config_get_global( 'show_detailed_errors' ) ) {
$t_config['settings'] = array( 'displayErrorDetails' => true );
}

Expand Down Expand Up @@ -76,7 +75,8 @@
$t_error_to_log = $p_exception->getMessage() . "\n" . $t_stack_as_string;
error_log( $t_error_to_log );

if( $t_show_detailed_errors ) {
$t_settings = $p_container->get('settings');
if( $t_settings['displayErrorDetails'] ) {
$p_response = $p_response->withJson( $t_data );
}

Expand Down

0 comments on commit af72555

Please sign in to comment.