summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rwxr-xr-xext/pcntl/pcntl.c8
-rw-r--r--ext/pcntl/php_signal.c13
-rw-r--r--ext/pcntl/tests/pcntl_signal.phpt6
-rw-r--r--ext/standard/info.c6
-rw-r--r--ext/standard/tests/file/bug22414.phpt2
-rw-r--r--ext/standard/tests/general_functions/phpinfo.phpt1
6 files changed, 29 insertions, 7 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index d07b9ea047..866106c44a 100755
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -849,6 +849,11 @@ PHP_FUNCTION(pcntl_signal)
return;
}
+ if (signo < 1 || signo > 32) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid signal");
+ RETURN_FALSE;
+ }
+
if (!PCNTL_G(spares)) {
/* since calling malloc() from within a signal handler is not portable,
* pre-allocate a few records for recording signals */
@@ -864,8 +869,9 @@ PHP_FUNCTION(pcntl_signal)
/* Special long value case for SIG_DFL and SIG_IGN */
if (Z_TYPE_P(handle)==IS_LONG) {
- if (Z_LVAL_P(handle)!= (long) SIG_DFL && Z_LVAL_P(handle) != (long) SIG_IGN) {
+ if (Z_LVAL_P(handle) != (long) SIG_DFL && Z_LVAL_P(handle) != (long) SIG_IGN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for handle argument specified");
+ RETURN_FALSE;
}
if (php_signal(signo, (Sigfunc *) Z_LVAL_P(handle), (int) restart_syscalls) == SIG_ERR) {
PCNTL_G(last_error) = errno;
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 00ab6b425f..92ec411314 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -18,6 +18,7 @@
/* $Id$ */
+#include "TSRM.h"
#include "php_signal.h"
/* php_signal using sigaction is derrived from Advanced Programing
@@ -26,6 +27,10 @@ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
{
struct sigaction act,oact;
act.sa_handler = func;
+#ifdef ZEND_SIGNALS
+ TSRMLS_FETCH();
+#endif
+
if (mask_all) {
sigfillset(&act.sa_mask);
} else {
@@ -41,9 +46,15 @@ Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
#endif
}
+#ifdef ZEND_SIGNALS
+ if (zend_sigaction(signo, &act, &oact TSRMLS_CC) < 0)
+#else
if (sigaction(signo, &act, &oact) < 0)
+#endif
+ {
return SIG_ERR;
-
+ }
+
return oact.sa_handler;
}
diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt
index 977f26fbcc..efd4bba953 100644
--- a/ext/pcntl/tests/pcntl_signal.phpt
+++ b/ext/pcntl/tests/pcntl_signal.phpt
@@ -28,12 +28,10 @@ Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
NULL
bool(true)
-Warning: pcntl_signal(): Invalid value for handle argument specified in %s
-
-Warning: pcntl_signal(): Error assigning signal %s
+Warning: pcntl_signal(): Invalid signal %s
bool(false)
-Warning: pcntl_signal(): Error assigning signal %s
+Warning: pcntl_signal(): Invalid signal %s
bool(false)
Warning: pcntl_signal(): not callable is not a callable function name error in %s
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 18a1e947da..2bee7e9803 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -747,6 +747,12 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
php_info_print_table_row(2, "Thread Safety", "disabled" );
#endif
+#ifdef ZEND_SIGNALS
+ php_info_print_table_row(2, "Zend Signal Handling", "enabled" );
+#else
+ php_info_print_table_row(2, "Zend Signal Handling", "disabled" );
+#endif
+
php_info_print_table_row(2, "Zend Memory Manager", is_zend_mm(TSRMLS_C) ? "enabled" : "disabled" );
{
diff --git a/ext/standard/tests/file/bug22414.phpt b/ext/standard/tests/file/bug22414.phpt
index fcd85489f3..9538c8ede8 100644
--- a/ext/standard/tests/file/bug22414.phpt
+++ b/ext/standard/tests/file/bug22414.phpt
@@ -7,7 +7,7 @@ output_handler=
$php = getenv('TEST_PHP_EXECUTABLE');
$tmpfile = tempnam(__DIR__, 'phpt');
- $args = ' -n -dsafe_mode=off ';
+ $args = ' -n ';
/* Regular Data Test */
passthru($php . $args . ' -r " echo \"HELLO\"; "');
diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt
index 1e2494ccb9..df6aef832e 100644
--- a/ext/standard/tests/general_functions/phpinfo.phpt
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -35,6 +35,7 @@ PHP Extension Build => API%s
Debug Build => %s
Thread Safety => %s
Zend Memory Manager => %s
+Zend Signal Handling => %s
Zend Multibyte Support => %s
IPv6 Support => %s
DTrace Support => %s