diff --git a/core/lib/Drupal/Core/Database/Query/Condition.php b/core/lib/Drupal/Core/Database/Query/Condition.php index 51693576e8..891b7e910b 100644 --- a/core/lib/Drupal/Core/Database/Query/Condition.php +++ b/core/lib/Drupal/Core/Database/Query/Condition.php @@ -4,6 +4,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Database\InvalidQueryException; +use Drupal\Core\Site\Settings; /** * Generic class for a series of conditions in a query. @@ -243,6 +244,9 @@ public function compile(Connection $connection, PlaceholderInterface $queryPlace // broken. // On top of that the database API relies on __toString() which // does not allow to throw exceptions. + if (Settings::get('development_mode', FALSE)) { + throw new \InvalidArgumentException('Invalid characters in query operator: ' . $condition['operator']); + } trigger_error('Invalid characters in query operator: ' . $condition['operator'], E_USER_ERROR); return; } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index ce48afe725..1be741df94 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -872,6 +872,15 @@ function system_requirements($phase) { } $requirements['update status']['title'] = t('Update notifications'); + if (Settings::get('development_mode', FALSE)) { + $requirements['development_mode'] = [ + 'title' => t('Development mode'), + 'value' => t('Enabled'), + 'severity' => REQUIREMENT_WARNING, + 'description' => t('Development mode is enabled in settings.php. It is recommended to have this setting disabled in production environments.'), + ]; + } + if (Settings::get('rebuild_access')) { $requirements['rebuild access'] = [ 'title' => t('Rebuild access'), diff --git a/sites/example.settings.local.php b/sites/example.settings.local.php index 330be144c5..9dacb19818 100644 --- a/sites/example.settings.local.php +++ b/sites/example.settings.local.php @@ -115,3 +115,15 @@ * directory. */ $settings['skip_permissions_hardening'] = TRUE; + +/** + * Development mode: + * + * This setting can be set to TRUE to enable more verbose error messages. We try + * for example to not only log errors, but also show them in development mode. + * This is unrelated with development specific settings, like disabled twig + * caching or aggregated css and JS. + * + * Not recommended in production environments. + */ +# $settings['development_mode'] = TRUE;