Skip to content

Commit

Permalink
Allow display of detailed errors from REST API
Browse files Browse the repository at this point in the history
If MantisBT config `show_detailed_errors` is on, then the Slim app
object will be initialized with setting `displayErrorDetails` = true.

Fixes #23537
  • Loading branch information
dregad committed Oct 26, 2017
1 parent b9b866d commit 8e663b3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api/rest/index.php
Expand Up @@ -42,7 +42,15 @@
# For example, this will disable logic like encoding dates with XSD meta-data.
ApiObjectFactory::$soap = false;

$g_app = new \Slim\App();

# Show SLIM detailed errors according to Mantis settings
$t_config = array();
if( ON == config_get_global( 'show_detailed_errors' ) ) {
$t_config['settings'] = array( 'displayErrorDetails' => true );
}
$t_container = new \Slim\Container( $t_config );

$g_app = new \Slim\App( $t_container );

# Add middleware - executed in reverse order of appearing here.
$g_app->add( new ApiEnabledMiddleware() );
Expand All @@ -61,4 +69,3 @@
event_signal( 'EVENT_REST_API_ROUTES', array( array( 'app' => $g_app ) ) );

$g_app->run();

0 comments on commit 8e663b3

Please sign in to comment.