Merge "API: Fix ApiMainTest::testExceptionErrors and use $wgShowDBErrorBacktrace"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 22 Feb 2017 01:48:28 +0000 (01:48 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 22 Feb 2017 01:48:29 +0000 (01:48 +0000)
includes/api/ApiMain.php
tests/phpunit/includes/api/ApiMainTest.php

index 59227d9..9e00830 100644 (file)
@@ -1116,7 +1116,9 @@ class ApiMain extends ApiBase {
                                )
                        );
                } else {
-                       if ( $config->get( 'ShowExceptionDetails' ) ) {
+                       if ( $config->get( 'ShowExceptionDetails' ) &&
+                               ( !$e instanceof DBError || $config->get( 'ShowDBErrorBacktrace' ) )
+                       ) {
                                $result->addContentValue(
                                        $path,
                                        'trace',
index eff41e3..9060dfb 100644 (file)
@@ -451,7 +451,10 @@ class ApiMainTest extends ApiTestCase {
                $context->setRequest( new FauxRequest( [ 'errorformat' => 'plaintext' ] ) );
                $context->setLanguage( 'en' );
                $context->setConfig( new MultiConfig( [
-                       new HashConfig( [ 'ShowHostnames' => true, 'ShowSQLErrors' => false ] ),
+                       new HashConfig( [
+                               'ShowHostnames' => true, 'ShowSQLErrors' => false,
+                               'ShowExceptionDetails' => true, 'ShowDBErrorBacktrace' => true,
+                       ] ),
                        $context->getConfig()
                ] ) );