Skip to content

Commit

Permalink
Fix "Fatal error: Property with asymmetric visibility Swoole\Process\…
Browse files Browse the repository at this point in the history
…Pool::$master_pid must have type" under php-8.4.
  • Loading branch information
matyhtf committed Dec 5, 2024
1 parent 44c23e2 commit 4e857cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion ext-src/php_swoole_cxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
_(SW_ZEND_STR_USE_PIPELINE_READ, "usePipelineRead") \
_(SW_ZEND_STR_TRAILER, "trailer") \
_(SW_ZEND_STR_MASTER_PID, "master_pid") \
_(SW_ZEND_PROP_MASTER_PID, "masterPid") \
_(SW_ZEND_STR_CALLBACK, "callback") \
_(SW_ZEND_STR_OPCODE, "opcode") \
_(SW_ZEND_STR_CODE, "code") \
Expand Down
7 changes: 2 additions & 5 deletions ext-src/swoole_process_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ void php_swoole_process_pool_minit(int module_number) {
SW_SET_CLASS_CUSTOM_OBJECT(
swoole_process_pool, process_pool_create_object, process_pool_free_object, ProcessPoolObject, std);

zend_declare_property_long(
swoole_process_pool_ce, ZEND_STRL("master_pid"), -1, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED);
zend_declare_property_long(swoole_process_pool_ce, ZEND_STRL("masterPid"), -1, ZEND_ACC_PUBLIC);
zend_declare_property_long(swoole_process_pool_ce, ZEND_STRL("master_pid"), -1, ZEND_ACC_PUBLIC);
zend_declare_property_long(swoole_process_pool_ce, ZEND_STRL("workerPid"), -1, ZEND_ACC_PUBLIC);
zend_declare_property_long(swoole_process_pool_ce, ZEND_STRL("workerId"), -1, ZEND_ACC_PUBLIC);
zend_declare_property_null(swoole_process_pool_ce, ZEND_STRL("workers"), ZEND_ACC_PUBLIC);
Expand Down Expand Up @@ -261,7 +259,6 @@ static void process_pool_onStart(ProcessPool *pool) {
zval args[1];

zend_update_property_long(swoole_process_pool_ce, SW_Z8_OBJ_P(zobject), ZEND_STRL("master_pid"), getpid());
zend_update_property_long(swoole_process_pool_ce, SW_Z8_OBJ_P(zobject), ZEND_STRL("masterPid"), getpid());
zend_update_property_bool(swoole_process_pool_ce, SW_Z8_OBJ_P(zobject), ZEND_STRL("running"), true);

if (pp->onStart == nullptr) {
Expand Down Expand Up @@ -711,7 +708,7 @@ static PHP_METHOD(swoole_process_pool, stop) {
}

static PHP_METHOD(swoole_process_pool, shutdown) {
long pid = zend::object_get_long(ZEND_THIS, SW_ZSTR_KNOWN(SW_ZEND_PROP_MASTER_PID));
long pid = zend::object_get_long(ZEND_THIS, SW_ZSTR_KNOWN(SW_ZEND_STR_MASTER_PID));
if (pid > 0) {
RETURN_BOOL(swoole_kill(pid, SIGTERM) == 0);
} else {
Expand Down

0 comments on commit 4e857cf

Please sign in to comment.