Skip to content

Commit

Permalink
fix tests [2], filter=unit
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Sep 25, 2024
1 parent fa4efb4 commit 11652e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ext-src/php_swoole_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -979,10 +979,14 @@ static sw_inline void sw_zend_fci_cache_free(void *fci_cache) {
}

static zend_fcall_info_cache *sw_zend_fci_cache_create(zval *zfn) {
if (!zval_is_true(zfn)) {
php_swoole_fatal_error(E_WARNING, "illegal callback function");
return nullptr;
}
char *func_name = nullptr;
zend_fcall_info_cache *fci_cache = (zend_fcall_info_cache *) emalloc(sizeof(zend_fcall_info_cache));
if (!sw_zend_is_callable_ex(zfn, nullptr, 0, &func_name, nullptr, fci_cache, nullptr)) {
php_swoole_fatal_error(E_ERROR, "function '%s' is not callable", func_name);
php_swoole_fatal_error(E_WARNING, "function '%s' is not callable", func_name);
efree(fci_cache);
efree(func_name);
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion tests/swoole_process/null_callback.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ $process->start();

?>
--EXPECTF--
Fatal error: Swoole\Process::start(): Illegal callback function of Swoole\Process in %s
Warning: Swoole\Process::start(): illegal callback function in %s

0 comments on commit 11652e4

Please sign in to comment.