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 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: 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

Add a Patch

Pull Requests

Add a Pull Request

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 May 18 21:01:33 2024 UTC