]> granicus.if.org Git - php/commitdiff
- Fixed bug #47779 (Wrong value for SIG_UNBLOCK and SIG_SETMASK constants).
authorFelipe Pena <felipe@php.net>
Wed, 25 Mar 2009 22:49:43 +0000 (22:49 +0000)
committerFelipe Pena <felipe@php.net>
Wed, 25 Mar 2009 22:49:43 +0000 (22:49 +0000)
  Patch by: mbeccati at php.net

ext/pcntl/pcntl.c
ext/pcntl/tests/003.phpt [new file with mode: 0644]

index e48e330e39e49b13e407cbc99a0ca70522a196c1..723dd809dcc81fc7c71a2b460c3837bd322f323d 100755 (executable)
@@ -264,8 +264,8 @@ void php_register_signal_constants(INIT_FUNC_ARGS)
        /* {{{ "how" argument for sigprocmask */
 #ifdef HAVE_SIGPROCMASK
        REGISTER_LONG_CONSTANT("SIG_BLOCK",   SIG_BLOCK, CONST_CS | CONST_PERSISTENT);
-       REGISTER_LONG_CONSTANT("SIG_UNBLOCK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT);
-       REGISTER_LONG_CONSTANT("SIG_SETMASK", SIG_BLOCK, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("SIG_UNBLOCK", SIG_UNBLOCK, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("SIG_SETMASK", SIG_SETMASK, CONST_CS | CONST_PERSISTENT);
 #endif
        /* }}} */
 
diff --git a/ext/pcntl/tests/003.phpt b/ext/pcntl/tests/003.phpt
new file mode 100644 (file)
index 0000000..012277d
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK
+--SKIPIF--
+<?php
+       if (!extension_loaded('pcntl')) die('skip pcntl extension not available');
+       elseif (!extension_loaded('posix')) die('skip posix extension not available');
+       elseif (!function_exists('pcntl_sigwaitinfo') or !function_exists('pcntl_sigtimedwait')) die('skip required functionality is not available');
+?>
+--FILE--
+<?php
+
+pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD,SIGTERM), $old);
+var_dump(count($old));
+pcntl_sigprocmask(SIG_BLOCK, array(SIGINT), $old);
+var_dump(count($old));
+pcntl_sigprocmask(SIG_UNBLOCK, array(SIGINT), $old);
+var_dump(count($old));
+pcntl_sigprocmask(SIG_SETMASK, array(SIGINT), $old);
+var_dump(count($old));
+pcntl_sigprocmask(SIG_SETMASK, array(), $old);
+var_dump(count($old));
+pcntl_sigprocmask(SIG_SETMASK, array(), $old);
+var_dump(count($old));
+
+?>
+--EXPECT--
+int(0)
+int(2)
+int(3)
+int(2)
+int(1)
+int(0)