php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73226 --r[fcez] always return zero exit code
Submitted: 2016-10-02 10:37 UTC Modified: -
From: bilge at scriptfusion dot com Assigned:
Status: Open Package: *General Issues
PHP Version: 5.6.26 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bilge at scriptfusion dot com
New email:
PHP Version: OS:

 

 [2016-10-02 10:37 UTC] bilge at scriptfusion dot com
Description:
------------
Switches --rf, --rc, --re and --rz always return a zero exit code whether the object exists or not. However, this is in contrast to --ri, which returns zero only if the extension exists and one if it does not.

I was not going to raise a bug until I noticed this is inconsistent, however I believe all lookups should return non-zero if the object doesn't exist since this makes them much easier to use in scripts to test if functionality is available.

Test script:
---------------
$ php --re foo; echo $?
Exception: Extension foo does not exist
0

$ php --re core; echo $?
<redacted>
0

$ php --ri foo; echo $?
Extension 'foo' not present.
1

$ php --ri core; echo $?
<redacted>
0



Expected result:
----------------
$ php --re foo; echo $?
Exception: Extension foo does not exist
1

$ php --re core; echo $?
<redacted>
0

$ php --ri foo; echo $?
Extension 'foo' not present.
1

$ php --ri core; echo $?
<redacted>
0




Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Dec 17 09:01:25 2018 UTC