]> granicus.if.org Git - php/commitdiff
Fixed a bug #44403 (register_tick_function() does not check for a valid callback)
authorIlia Alshanetsky <iliaa@php.net>
Sun, 20 Apr 2008 15:07:39 +0000 (15:07 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 20 Apr 2008 15:07:39 +0000 (15:07 +0000)
ext/standard/basic_functions.c

index 91cd6358410aa2afad3d28474aa86bfc853d494d..cd8ca4ab8c703b90edfd82f9ec83edcc1e599c04 100644 (file)
@@ -6045,6 +6045,7 @@ PHP_FUNCTION(register_tick_function)
 {
        user_tick_function_entry tick_fe;
        int i;
+       char *function_name = NULL;
 
        tick_fe.calling = 0;
        tick_fe.arg_count = ZEND_NUM_ARGS();
@@ -6060,6 +6061,13 @@ PHP_FUNCTION(register_tick_function)
                RETURN_FALSE;
        }
 
+       if (!zend_is_callable(tick_fe.arguments[0], 0, &function_name)) {
+         efree(tick_fe.arguments);
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid shutdown callback '%s' passed", function_name);
+         efree(function_name);
+         RETURN_FALSE;
+       }
+
        if (Z_TYPE_P(tick_fe.arguments[0]) != IS_ARRAY) {
                convert_to_string_ex(&tick_fe.arguments[0]);
        }