php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53518 pclose and proc_close do not return values for use with pcntl_wifexited
Submitted: 2010-12-10 13:54 UTC Modified: -
Votes:4
Avg. Score:3.8 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: ben dot spencer at digitalwindow dot com Assigned:
Status: Open Package: Program Execution
PHP Version: 5.3SVN-2010-12-10 (SVN) 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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ben dot spencer at digitalwindow dot com
New email:
PHP Version: OS:

 

 [2010-12-10 13:54 UTC] ben dot spencer at digitalwindow dot com
Description:
------------
The manual for pclose and proc_close states:

Note: Unix Only:

proc_close() is internally implemented using the waitpid(3) system call. To obtain the real exit status code the pcntl_wexitstatus() function should be used.

However, they in fact return the real exit code directly.  This makes it impossible to tell whether a program exited normally or was killed by a signal.


Test script:
---------------
http://www.pastie.org/1364987

Expected result:
----------------
Testing command: false

pclose test:
status value: int(256)
pcntl_wifexited: bool(true)
pcntl_wexitstatus: int(1)
pcntl_wifsignaled: bool(false)
pcntl_wtermsig: int(0)

proc_close test:
status value: int(256)
pcntl_wifexited: bool(true)
pcntl_wexitstatus: int(1)
pcntl_wifsignaled: bool(false)
pcntl_wtermsig: int(0)


Testing command: kill -1 $$

pclose test:
status value: int(1)
pcntl_wifexited: bool(false)
pcntl_wexitstatus: int(0)
pcntl_wifsignaled: bool(true)
pcntl_wtermsig: int(1)


proc_close test:
status value: int(1)
pcntl_wifexited: bool(false)
pcntl_wexitstatus: int(0)
pcntl_wifsignaled: bool(true)
pcntl_wtermsig: int(1)

Actual result:
--------------
Testing command: false

pclose test:
status value: int(1)
pcntl_wifexited: bool(false)
pcntl_wexitstatus: int(0)
pcntl_wifsignaled: bool(true)
pcntl_wtermsig: int(1)


proc_close test:
status value: int(1)
pcntl_wifexited: bool(false)
pcntl_wexitstatus: int(0)
pcntl_wifsignaled: bool(true)
pcntl_wtermsig: int(1)


Testing command: kill -1 $$

pclose test:
status value: int(1)
pcntl_wifexited: bool(false)
pcntl_wexitstatus: int(0)
pcntl_wifsignaled: bool(true)
pcntl_wtermsig: int(1)


proc_close test:
status value: int(1)
pcntl_wifexited: bool(false)
pcntl_wexitstatus: int(0)
pcntl_wifsignaled: bool(true)
pcntl_wtermsig: int(1)


Patches

exitcode.diff (last revision 2010-12-10 12:56 UTC by ben dot spencer at digitalwindow dot com)

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC