lbarnaud                Tue May 26 14:02:34 2009 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/pcntl/tests    bug47566.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/pcntl  pcntl.c 
    /php-src/ext/pcntl/tests    001.phpt 
  Log:
  MFH: Fix return value of pcntl_wexitstatus() (fixes #47566,
  patch by james at jamesreno dot com)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1521&r2=1.2027.2.547.2.1522&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1521 php-src/NEWS:1.2027.2.547.2.1522
--- php-src/NEWS:1.2027.2.547.2.1521    Tue May 26 05:57:40 2009
+++ php-src/NEWS        Tue May 26 14:02:33 2009
@@ -85,6 +85,8 @@
   literal). (Ilia)
 - Fixed bug #47616 (curl keeps crashing). (Felipe)
 - Fixed bug #47598 (FILTER_VALIDATE_EMAIL is locale aware). (Ilia)
+- Fixed bug #47566 (pcntl_wexitstatus() returns signed status).
+  (patch by james at jamesreno dot com)
 - Fixed bug #47564 (unpacking unsigned long 32bit bit endian returns wrong
   result). (Ilia)
 - Fixed bug #47487 (performance degraded when reading large chunks after fix of
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.7&r2=1.48.2.2.2.8&diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.7 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.8
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.7      Wed Dec 31 11:17:41 2008
+++ php-src/ext/pcntl/pcntl.c   Tue May 26 14:02:34 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.7 2008/12/31 11:17:41 sebastian Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.8 2009/05/26 14:02:34 lbarnaud Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -374,9 +374,7 @@
        
        status_word = (int) Z_LVAL_PP(status);
 
-       /* WEXITSTATUS only returns 8 bits so we *MUST* cast this to signed char
-          if you want to have valid negative exit codes */
-       RETURN_LONG((signed char) WEXITSTATUS(status_word));
+       RETURN_LONG(WEXITSTATUS(status_word));
 #else
        RETURN_FALSE;
 #endif
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/001.phpt?r1=1.8&r2=1.8.4.1&diff_format=u
Index: php-src/ext/pcntl/tests/001.phpt
diff -u php-src/ext/pcntl/tests/001.phpt:1.8 
php-src/ext/pcntl/tests/001.phpt:1.8.4.1
--- php-src/ext/pcntl/tests/001.phpt:1.8        Thu Dec 16 12:34:31 2004
+++ php-src/ext/pcntl/tests/001.phpt    Tue May 26 14:02:34 2009
@@ -73,7 +73,7 @@
 Staring wait.h tests....
 
 Testing pcntl_wifexited and wexitstatus....
-Exited With: -1
+Exited With: 255
 
 Testing pcntl_wifsignaled....
 Process was terminated by signal : SIGTERM

http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/bug47566.phpt?view=markup&rev=1.1
Index: php-src/ext/pcntl/tests/bug47566.phpt
+++ php-src/ext/pcntl/tests/bug47566.phpt
--TEST--
Bug #47566 (return value of pcntl_wexitstatus())
--SKIPIF--
<?php if (!extension_loaded("pcntl")) print "skip"; ?>
--FILE--
<?
$pid = pcntl_fork();
if ($pid == -1) {
 echo "Unable to fork";
 exit;
} elseif ($pid) {
 $epid = pcntl_waitpid(-1,$status);
 var_dump(pcntl_wexitstatus($status));
} else {
 exit(128);
}
?>
--EXPECT--
int(128)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to