diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 5c99f66..3c39e9c 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -178,8 +178,25 @@ function simpletest_run_tests($test_list) {
  */
 function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames) {
   $phpunit_file = simpletest_phpunit_xml_filepath($test_id);
-  simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file);
-  return simpletest_phpunit_xml_to_rows($test_id, $phpunit_file);
+  $ret = simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file);
+  if ($ret) {
+    // Something broke during the execution of phpunit.
+    // Return an error record of all failed classes.
+    $rows[] = [
+      'test_id' => '1',
+      'test_class' => implode(",", $unescaped_test_classnames),
+      'status' => 'fail',
+      'message' => 'PHPunit Test failed to complete',
+      'message_group' => 'Other',
+      'function' => implode(",", $unescaped_test_classnames),
+      'line' => '0',
+      'file' => $phpunit_file,
+    ];
+  }
+  else {
+    $rows = simpletest_phpunit_xml_to_rows($test_id, $phpunit_file);
+  }
+  return $rows;
 }
 
 /**
@@ -274,7 +291,7 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun
 
   // exec in a subshell so that the environment is isolated when running tests
   // via the simpletest UI.
-  $ret = exec(join($command, " "));
+  exec(join($command, " "), $output, $ret);
   chdir($old_cwd);
   putenv('SIMPLETEST_DB=');
   return $ret;
diff --git a/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php b/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php
new file mode 100644
index 0000000..2a01d30
--- /dev/null
+++ b/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\Tests\simpletest\Unit;
+
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * This test crashes PHP.
+ *
+ * To avoid accidentally running, it is not in a normal PSR-4 directory, the
+ * file name does not adhere to PSR-4 and an environment variable also needs to
+ * be set for the crash to happen.
+ *
+ * @runTestsInSeparateProcesses
+ * @preserveGlobalState disabled
+ */
+class SimpletestPhpunitRunCommandTestWillDie extends UnitTestCase {
+
+  public function testWillDie() {
+    if (getenv('SimpletestPhpunitRunCommandTestWillDie') === 'fail') {
+      // This causes a segmentation fault.
+      preg_match('/(.(?!b))*/', str_repeat("a", 10000));
+    }
+  }
+}
+
diff --git a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
new file mode 100644
index 0000000..f49fe5f
--- /dev/null
+++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTest.
+ */
+
+namespace Drupal\Tests\simpletest\Unit;
+
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Tests simpletest_run_phpunit_tests() handles PHPunit fatals correctly.
+ *
+ * @group simpletest
+ *
+ * @runTestsInSeparateProcesses
+ * @preserveGlobalState disabled
+ */
+class SimpletestPhpunitRunCommandTest extends UnitTestCase {
+
+  function testSimpletestPhpUnitRunCommand() {
+    include_once __DIR__ .'/../../fixtures/simpletest_phpunit_run_command_test.php';
+    $app_root = __DIR__ . '/../../../../../..';
+    include_once "$app_root/core/modules/simpletest/simpletest.module";
+    include_once "$app_root/core/includes/file.inc";
+    $container = new ContainerBuilder;
+    $container->set('app.root', $app_root);
+    $file_system = $this->prophesize('Drupal\Core\File\FileSystemInterface');
+    $file_system->realpath('public://simpletest')->willReturn(sys_get_temp_dir());
+    $container->set('file_system', $file_system->reveal());
+    \Drupal::setContainer($container);
+    $test_id = basename(tempnam(sys_get_temp_dir(), 'xxx'));
+    foreach (['pass', 'fail'] as $status) {
+      putenv('SimpletestPhpunitRunCommandTestWillDie=' . $status);
+      $ret = simpletest_run_phpunit_tests($test_id, ['Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTestWillDie']);
+      $this->assertSame($ret[0]['status'], $status);
+    }
+    unlink(simpletest_phpunit_xml_filepath($test_id));
+  }
+
+}
