diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
index 11de754..090dd43 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
@@ -54,7 +54,6 @@ function setUp() {
    * Test the internal browsers functionality.
    */
   function testInternalBrowser() {
-    global $conf;
     if (!$this->inCURL()) {
       // Retrieve the test page and check its title and headers.
       $this->drupalGet('test-page');
@@ -183,8 +182,10 @@ function stubTest() {
 
     $this->pass(t('Test ID is @id.', array('@id' => $this->testId)));
 
-    // Generates a warning.
-    $i = 1 / 0;
+    // Generate a warning. The trigger_error() function requires to pass an
+    // error message string as a parameter and will throw an E_WARNING error
+    // when omitted.
+    trigger_error();
 
     // Call an assert function specific to that class.
     $this->assertNothing();
@@ -214,8 +215,10 @@ function confirmStubTestResults() {
     $this->assertAssertion(t('Created permissions: @perms', array('@perms' => $this->valid_permission)), 'Role', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
     $this->assertAssertion(t('Invalid permission %permission.', array('%permission' => $this->invalid_permission)), 'Role', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
 
-    // Check that a warning is caught by simpletest.
-    $this->assertAssertion('Division by zero', 'Warning', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
+    /// Check that a warning is caught by simpletest. The exact error message
+    // differs between PHP versions so we check only the function name
+    // 'trigger_error()'.
+    $this->assertAssertion('trigger_error()', 'Warning', 'Fail', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
 
     // Check that the backtracing code works for specific assert function.
     $this->assertAssertion('This is nothing.', 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\simpletest\Tests\SimpleTestTest->stubTest()');
