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: 2021-07-12 21:06 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bilge at scriptfusion dot com Assigned: cmb (profile)
Status: Closed Package: *General Issues
PHP Version: 5.6.26 OS: Linux
Private report: No CVE-ID: None
 [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

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-12 21:06 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2021-07-12 21:07 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #73226: --r[fcez] always return zero exit code
On GitHub:  https://github.com/php/php-src/pull/7221
Patch:      https://github.com/php/php-src/pull/7221.patch
 [2021-07-12 21:15 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/php-src/commit/9db3eda2cbaa01529d807b2326be13e7b0e5e496
Log: Fix #73226: --r[fcez] always return zero exit code
 [2021-07-12 21:15 UTC] git@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC