php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #18027 exit(0) in command-line use produces 255
Submitted: 2002-06-27 17:26 UTC Modified: 2002-06-27 17:30 UTC
From: befletch at yahoo dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.2.1 OS: OpenBSD 3.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: befletch at yahoo dot com
New email:
PHP Version: OS:

 

 [2002-06-27 17:26 UTC] befletch at yahoo dot com
Consider the following command line script:

#!/usr/local/bin/php -q
<?php

exit( 0 );

?>

With PHP 4.1.2, this returned 0 to the calling
process (e.g. the $? shell variable).  With
PHP 4.2.1, this no longer works - exit(0) returns
255.

I don't know if this is intentional or not, but
now the only way I can use 0 for success and !0
for errors is:

$return_val = whatever();

if ( $return_val === 0 )
  return 0;
else
  exit( $return_val );

Can this be returned to the older way of doing
things?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-27 17:30 UTC] derick@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 17:01:25 2024 UTC