Fixed CLI command should set non-zero return value on error

Kirby

Well-known member
Affected version
2.0.10
Steps to reproduce
  1. Install XenForo
  2. Upload an Add-on that as a Setup.php
  3. Simulate an error by modifying method install to call an undefined function
Expected Result
Installation is aborted with an error message and the return value is not 0

Actual Result
Installation reports an error during setup, continues to import Add-on data and sets the return value to 0
 
This is potentially somewhat difficult, as if you're calling an undefined function, that's traditionally a fatal error, so we actually have no control over how PHP terminates. I'd have to check what it does regarding the exit code.

Things have changed a bit in PHP7 though, so we might have more scope there.
 
Frankly I don't care for PHP 5 ;)
But I do care for our CI-Server not letting builds pass that are in fact broken, so just catching \Error as well would be sufficient for me.
 
Last edited:
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in a future XF release (2.0.12).

Change log:
Ensure exceptions in sub-processes stop execution, and always exit with non-zero error code on error.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom