]> granicus.if.org Git - php/commitdiff
Fix to not attempt to call if handler is long. Idea for this came
authorDavid Walker <dave@mudsite.com>
Wed, 6 Jul 2016 12:45:20 +0000 (06:45 -0600)
committerAaron Piotrowski <aaron@trowski.com>
Wed, 6 Jul 2016 18:57:37 +0000 (13:57 -0500)
from comment on PR.

ext/pcntl/pcntl.c

index 811f7406ced210d1478289045d232da44888a00c..67168868b7f00f866c0f26ed85b07050416ad2cc 100644 (file)
@@ -1392,14 +1392,16 @@ void pcntl_signal_dispatch()
 
        while (queue) {
                if ((handle = zend_hash_index_find(&PCNTL_G(php_signal_table), queue->signo)) != NULL) {
-                       ZVAL_NULL(&retval);
-                       ZVAL_LONG(&param, queue->signo);
-
-                       /* Call php signal handler - Note that we do not report errors, and we ignore the return value */
-                       /* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */
-                       call_user_function(EG(function_table), NULL, handle, &retval, 1, &param);
-                       zval_ptr_dtor(&param);
-                       zval_ptr_dtor(&retval);
+                       if (Z_TYPE_P(handle) != IS_LONG) {
+                               ZVAL_NULL(&retval);
+                               ZVAL_LONG(&param, queue->signo);
+
+                               /* Call php signal handler - Note that we do not report errors, and we ignore the return value */
+                               /* FIXME: this is probably broken when multiple signals are handled in this while loop (retval) */
+                               call_user_function(EG(function_table), NULL, handle, &retval, 1, &param);
+                               zval_ptr_dtor(&param);
+                               zval_ptr_dtor(&retval);
+                       }
                }
 
                next = queue->next;