Mercurial > hg > isophonics-drupal-site
view core/lib/Drupal/Component/Assertion/Handle.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\Component\Assertion; /** * Handler for runtime assertion failures. * * This class allows PHP 5.x to throw exceptions on runtime assertion fails * in the same manner as PHP 7, and sets the ASSERT_EXCEPTION flag to TRUE * for the PHP 7 runtime. * * @ingroup php_assert */ class Handle { /** * Registers uniform assertion handling. */ public static function register() { // Since we're using exceptions, turn error warnings off. assert_options(ASSERT_WARNING, FALSE); if (version_compare(PHP_VERSION, '7.0.0-dev') < 0) { if (!class_exists('AssertionError', FALSE)) { require __DIR__ . '/global_namespace_php5.php'; } // PHP 5 - create a handler to throw the exception directly. assert_options(ASSERT_CALLBACK, function ($file = '', $line = 0, $code = '', $message = '') { if (empty($message)) { $message = $code; } throw new \AssertionError($message, 0, NULL, $file, $line); }); } else { // PHP 7 - just turn exception throwing on. assert_options(ASSERT_EXCEPTION, TRUE); } } }