Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Sep 25, 2024
1 parent ea8495a commit fa4efb4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ext-src/swoole_coroutine_scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ void php_swoole_coroutine_scheduler_rshutdown() {
});

if (exit_condition_fci_cache) {
exit_condition_fci_cache = nullptr;
sw_zend_fci_cache_free(exit_condition_fci_cache);
exit_condition_fci_cache = nullptr;
}
}

Expand Down
4 changes: 2 additions & 2 deletions ext-src/swoole_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static void server_free_object(zend_object *object) {
for (int i = 0; i < PHP_SWOOLE_SERVER_CALLBACK_NUM; i++) {
zend_fcall_info_cache *fci_cache = property->callbacks[i];
if (fci_cache) {
efree(fci_cache);
sw_zend_fci_cache_free(fci_cache);
property->callbacks[i] = nullptr;
}
}
Expand Down Expand Up @@ -2424,7 +2424,7 @@ static PHP_METHOD(swoole_server, on) {
swoole_server_ce, SW_Z8_OBJ_P(ZEND_THIS), property_name.c_str(), property_name.length(), cb);

if (server_object->property->callbacks[event_type]) {
efree(server_object->property->callbacks[event_type]);
sw_zend_fci_cache_free(server_object->property->callbacks[event_type]);
}

auto fci_cache = sw_zend_fci_cache_create(cb);
Expand Down
6 changes: 2 additions & 4 deletions ext-src/swoole_server_port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void php_swoole_server_port_deref(zend_object *object) {
if (property->serv) {
for (int j = 0; j < PHP_SWOOLE_SERVER_PORT_CALLBACK_NUM; j++) {
if (property->caches[j]) {
efree(property->caches[j]);
sw_zend_fci_cache_free(property->caches[j]);
property->caches[j] = nullptr;
}
}
Expand Down Expand Up @@ -191,8 +191,6 @@ void php_swoole_server_port_minit(int module_number) {
* [Master/Worker]
*/
static ssize_t php_swoole_server_length_func(const Protocol *protocol, network::Socket *conn, PacketLength *pl) {
Server *serv = (Server *) protocol->private_data_2;

zend_fcall_info_cache *fci_cache = (zend_fcall_info_cache *) protocol->private_data;
zval zdata;
zval retval;
Expand Down Expand Up @@ -622,7 +620,7 @@ static PHP_METHOD(swoole_server_port, on) {
sw_zend_read_property(swoole_server_port_ce, ZEND_THIS, property_name.c_str(), property_name.length(), 0);
sw_copy_to_stack(property->callbacks[index], property->_callbacks[index]);
if (property->caches[index]) {
efree(property->caches[index]);
sw_zend_fci_cache_free(property->caches[index]);
}

auto fci_cache = sw_zend_fci_cache_create(cb);
Expand Down
6 changes: 1 addition & 5 deletions tests/swoole_http_server/callback_with_private.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ $pm->run(true);
//Fatal Error
$pm->expectExitCode(255);
$output = $pm->getChildOutput();
if (PHP_VERSION_ID < 80000) {
Assert::contains($output, 'Swoole\Server::on() must be callable');
} else {
Assert::contains($output, 'Swoole\Server::on(): function \'TestCo_9::foo\' is not callable');
}
Assert::contains($output, "Swoole\Server\Port::on(): function 'TestCo_9::foo' is not callable");
?>
--EXPECT--
6 changes: 1 addition & 5 deletions tests/swoole_http_server/callback_with_protected.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ $pm = ProcessManager::exec(function ($pm) {
//Fatal Error
$pm->expectExitCode(255);
$output = $pm->getChildOutput();
if (PHP_VERSION_ID < 80000) {
Assert::contains($output, 'Swoole\Server::on() must be callable');
} else {
Assert::contains($output, 'Swoole\Server::on(): function \'TestCo::foo\' is not callable');
}
Assert::contains($output, 'Swoole\Server\Port::on(): function \'TestCo::foo\' is not callable');
?>
--EXPECT--

0 comments on commit fa4efb4

Please sign in to comment.