php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65240 Return code not updating exit status
Submitted: 2013-07-10 20:14 UTC Modified: 2013-07-11 18:48 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: rkelley at transperfect dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.4.17 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rkelley at transperfect dot com
New email:
PHP Version: OS:

 

 [2013-07-10 20:14 UTC] rkelley at transperfect dot com
Description:
------------
When the top level function does a return, that code is not reflected in the exit status.

Test script:
---------------
php -r 'return(1);' ; echo $?



Expected result:
----------------
1

Actual result:
--------------
0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-11 06:06 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2013-07-11 06:06 UTC] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

php -r 'exit(0);' ; echo $?
 [2013-07-11 18:48 UTC] rkelley at transperfect dot com
I see in the manual where it say return will end the execution if it is in the top level function or a script but it does not state what it does with the return value explicit for a script. When filling this bug I referred to C++ where a return 1 in the main function would result in a exit code of 1 being seen on the shell.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 01:01:35 2025 UTC