_drupal_log_error() should return a non-zero exit code on errors in the cli

Created on 8 February 2024, 4 months ago
Updated 26 April 2024, about 2 months ago

Problem/Motivation

We execute run-test.sh during CI runs. After an upgrade to PHP 8.1 the test pipeline did not fail although no tests were executed and there was a fatal TypeError.

Steps to reproduce

1. Remove the "static" keyword from a Simpletest test case method getInfo()
2. Execute run-tests.sh to get an error like "TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method PrivatemsgEMailNotifyTestCase::getInfo() cannot be called statically in simpletest_test_get_all() (line 372 of /var/www/html/modules/simpletest/simpletest.module)." For example: ddev exec php ./scripts/run-tests.sh --verbose Jobiqo
3. notice that the exit code is 0 for success, which is bad because that indicates that there was no error.

Proposed resolution

Exit with status code 1 in _drupal_log_error() for CLI scripts.

Merge request link

Remaining tasks

Merge request review

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

7.0 ⚰️

Component
Simpletest 

Last updated 1 day ago

Created by

🇦🇹Austria klausi 🇦🇹 Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024