From 2ee8a1d2df835e9f2cf8ff3b91516a9082d55381 Mon Sep 17 00:00:00 2001 From: twosee Date: Tue, 28 May 2019 15:14:05 +0800 Subject: [PATCH] Move php_swoole_load_library to RINIT. --- remake_library.sh | 4 ++-- swoole.cc | 5 +++-- swoole_runtime.cc | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/remake_library.sh b/remake_library.sh index 1dd72890648..9f10dffa835 100755 --- a/remake_library.sh +++ b/remake_library.sh @@ -4,8 +4,8 @@ __DIR__=$(cd "$(dirname "$0")";pwd) set -e cd ${__DIR__} set +e -echo "rm swoole_runtime.lo" -rm swoole_runtime.lo +echo "rm swoole.lo" +rm swoole.lo echo "rm php_swoole_library.h" rm php_swoole_library.h set -e diff --git a/swoole.cc b/swoole.cc index 318709c0ff1..4bc699c8280 100644 --- a/swoole.cc +++ b/swoole.cc @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ */ #include "php_swoole_cxx.h" -#include "zend_variables.h" +#include "php_swoole_library.h" #if (HAVE_PCRE || HAVE_BUNDLED_PCRE) && !defined(COMPILE_DL_PCRE) #include "ext/pcre/php_pcre.h" @@ -933,8 +933,9 @@ PHP_MINFO_FUNCTION(swoole) PHP_RINIT_FUNCTION(swoole) { SWOOLE_G(req_status) = PHP_SWOOLE_RINIT_BEGIN; - php_swoole_register_shutdown_function("swoole_internal_call_user_shutdown_begin"); SwooleG.running = 1; + php_swoole_register_shutdown_function("swoole_internal_call_user_shutdown_begin"); + php_swoole_load_library(); SWOOLE_G(req_status) = PHP_SWOOLE_RINIT_END; return SUCCESS; } diff --git a/swoole_runtime.cc b/swoole_runtime.cc index 41368524b72..1899dc5f7eb 100644 --- a/swoole_runtime.cc +++ b/swoole_runtime.cc @@ -44,8 +44,6 @@ static int socket_close(php_stream *stream, int close_handle); static int socket_stat(php_stream *stream, php_stream_statbuf *ssb); static int socket_cast(php_stream *stream, int castas, void **ret); -#include "php_swoole_library.h" - static void replace_internal_function(const char *name, size_t l_name); static void recover_internal_function(const char *name, size_t l_name); @@ -1248,8 +1246,6 @@ bool PHPCoroutine::inject_function() return false; } - php_swoole_load_library(); - function_table = (zend_array*) emalloc(sizeof(zend_array)); zend_hash_init(function_table, 8, NULL, NULL, 0); /**