Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300822

_drupal_log_error() returns a 0 exit code on errors

$
0
0

When _drupal_log_error() is called with a fatal error, the PHP process exits with a zero:

  if (PHP_SAPI === 'cli') {
    if ($fatal) {
      // When called from CLI, simply output a plain text message.
      // Should not translate the string to avoid errors producing more errors.
      $response->setContent(html_entity_decode(strip_tags(SafeMarkup::format('%type: @message in %function (line %line of %file).', $error))) . "\n");
      $response->send();
      exit;
    }
  }

This causes CLI tools like Behat to exit 0 even though a fatal was raised, confusing CI tools that rely on the exit code.

I'd guess that just exit(1); would be enough here.


Viewing all articles
Browse latest Browse all 300822

Trending Articles