diff --git a/core/lib/Drupal/Component/Assertion/Handle.php b/core/lib/Drupal/Component/Assertion/Handle.php index 3912156fc4e7ad1c3c859a18b8478b02a97eaef3..dd9911e6a398810e08abe29ee5b7748b9d633088 100644 --- a/core/lib/Drupal/Component/Assertion/Handle.php +++ b/core/lib/Drupal/Component/Assertion/Handle.php @@ -57,7 +57,7 @@ public static function register() { if (version_compare(PHP_VERSION, '7.0.0-dev') < 0) { // PHP 5 - create a handler to throw the exception directly. - assert_options(ASSERT_CALLBACK, function($file, $line, $code, $message) { + assert_options(ASSERT_CALLBACK, function($file = '', $line = 0, $code = '', $message = '') { if (empty($message)) { $message = $code; } diff --git a/core/modules/simpletest/src/Tests/SimpleTestTest.php b/core/modules/simpletest/src/Tests/SimpleTestTest.php index c3758a7f8544b59dc23f433c555f34267f569035..8785897014ef470aa74bba1d13b4cb06e736834a 100644 --- a/core/modules/simpletest/src/Tests/SimpleTestTest.php +++ b/core/modules/simpletest/src/Tests/SimpleTestTest.php @@ -167,11 +167,20 @@ function stubTest() { // Check to see if runtime assertions are indeed on, if successful this // will be the first of sixteen passes asserted in confirmStubResults() try { - assert(FALSE, 'Lorem Ipsum'); + // Test with minimum possible arguments to make sure no notice for + // missing argument is thrown. + assert(FALSE); $this->fail('Runtime assertions are not working.'); } catch (\AssertionError $e) { - $this->assertEqual($e->getMessage(), 'Lorem Ipsum', 'Runtime assertions Enabled and running.'); + try { + // Now test with an error message to insure it is correctly passed + // along by the rethrow. + assert(FALSE, 'Lorem Ipsum'); + } + catch ( \AssertionError $e ) { + $this->assertEqual($e->getMessage(), 'Lorem Ipsum', 'Runtime assertions Enabled and running.'); + } } // This causes the second of the sixteen passes asserted in // confirmStubResults().