{
zval *func1 = tick_fe1->arguments[0];
zval *func2 = tick_fe2->arguments[0];
+ int ret;
TSRMLS_FETCH();
if (Z_TYPE_P(func1) == IS_STRING && Z_TYPE_P(func2) == IS_STRING) {
- return (zend_binary_zval_strcmp(func1, func2) == 0);
+ ret = (zend_binary_zval_strcmp(func1, func2) == 0);
} else if (Z_TYPE_P(func1) == IS_UNICODE && Z_TYPE_P(func2) == IS_UNICODE) {
- return (zend_u_binary_zval_strcmp(func1, func2) == 0);
+ ret = (zend_u_binary_zval_strcmp(func1, func2) == 0);
} else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) {
zval result;
zend_compare_arrays(&result, func1, func2 TSRMLS_CC);
- return (Z_LVAL(result) == 0);
+ ret = (Z_LVAL(result) == 0);
} else {
+ ret = 0;
+ }
+
+ if (ret && tick_fe1->calling) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to delete tick function executed at the moment");
return 0;
}
+ return ret;
}
void php_call_shutdown_functions(TSRMLS_D)
--- /dev/null
+--TEST--
+Bug #41037 (unregister_tick_function() inside the tick function crash PHP)
+--FILE--
+<?php
+
+function a() {
+ echo "hello";
+ unregister_tick_function('a');
+}
+
+declare (ticks=1);
+register_tick_function('a');
+
+echo "Done\n";
+?>
+--EXPECTF--
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
+Done
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d
+hello
+Warning: unregister_tick_function(): Unable to delete tick function executed at the moment in %s on line %d