Bug #80757 [NEW]: Exit code is 0 when could not open file

From: Date: Tue, 16 Feb 2021 16:07:57 +0000
Subject: Bug #80757 [NEW]: Exit code is 0 when could not open file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232204@lists.php.net to get a copy of this message
From: minterior at gmail dot com Operating system: Linux PHP version: Irrelevant Package: phpdbg Bug Type: Bug Bug description:Exit code is 0 when could not open file Description: ------------ Tested in PHP versions 8.0.2 and 7.4.3. When phpdbg can not open the given file it fails with the messages: [Could not open file /missing_file] [Failed to compile /missing_file, cannot run] But the exit code is 0, when it should not. On another hand, when the PHP file exists but has syntax errors it fails with: [PHP Parse error: syntax error, unexpected '!', expecting ';' or ',' in /invalid.php on line 3] If it throws an exception: [Uncaught Exception in /throw-exception.php on line 3] Exception: I'm an exception thrown in /throw-exception.php:3 Stack trace: #0 {main} In both cases, the exit code is then 255 as expected. Test script: --------------- # Tested without Docker in Kubuntu Linux 20.04.2 LTS phpdbg -qrr missing_file; echo $? [Could not open file /missing_file] [Failed to compile /missing_file, cannot run] 0 # Tested in Alpine Linux using Docker docker run --rm --tty php:cli-alpine phpdbg -qrr missing_file; echo $? [Could not open file /missing_file] [Failed to compile /missing_file, cannot run] 0 Expected result: ---------------- A non-zero exit code is expected. Actual result: -------------- The exit code is 0. -- Edit bug report at https://bugs.php.net/bug.php?id=80757&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80757&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80757&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80757&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80757&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80757&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80757&r=support Expected behavior: https://bugs.php.net/fix.php?id=80757&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80757&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80757&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80757&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80757&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80757&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80757&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80757&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80757&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80757&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80757&r=mysqlcfg

« previous php.bugs (#232204) next »