Skip to content

pull #15289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

pull #15289

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Zend/zend_modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ struct _zend_module_entry {
const struct _zend_module_dep *deps;
const char *name;
const struct _zend_function_entry *functions;
zend_result (*module_startup_func)(INIT_FUNC_ARGS);
zend_result (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
zend_result (*request_startup_func)(INIT_FUNC_ARGS);
zend_result (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
zend_result (*module_startup_func)(INIT_FUNC_ARGS); // MINIT()
zend_result (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); // MSHUTDOWN()
zend_result (*request_startup_func)(INIT_FUNC_ARGS); // RINIT()
zend_result (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); // RSHUTDOWN()
void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); // PHPINFO()
const char *version;
size_t globals_size;
#ifdef ZTS
ts_rsrc_id* globals_id_ptr;
#else
void* globals_ptr;
#endif
void (*globals_ctor)(void *global);
void (*globals_dtor)(void *global);
zend_result (*post_deactivate_func)(void);
void (*globals_ctor)(void *global); // GINIT
void (*globals_dtor)(void *global); // GSHUTDOWN
zend_result (*post_deactivate_func)(void); // PRSHUTDOWN()
int module_started;
unsigned char type;
void *handle;
Expand Down
10 changes: 10 additions & 0 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,8 @@ zend_result php_request_startup(void)
/* PG(during_request_startup) = 0; */

php_hash_environment();
// 在 php_request_startup() 函数中,通过 zend_activate_module() 触发 RINIT()。
printf("\033[0;31;43m========== 请求初始化: RINIT () ==========\033[0m\n");
zend_activate_modules();
PG(modules_activated)=1;
} zend_catch {
Expand Down Expand Up @@ -1837,6 +1839,8 @@ void php_request_shutdown(void *dummy)

/* 5. Call all extensions RSHUTDOWN functions */
if (PG(modules_activated)) {
// 在 php_request_shutdown() 函数中,通过 zend_deactivate_modules() 触发 RSHUTDOWN()。
printf("\033[0;31;43m========== 请求终止: RSHUTDOWN () ==========\033[0m\n");
zend_deactivate_modules();
}

Expand Down Expand Up @@ -1867,6 +1871,8 @@ void php_request_shutdown(void *dummy)

/* 11. Call all extensions post-RSHUTDOWN functions */
zend_try {
// 这个钩子很少使用。在 php_request_shutdown() 函数中,通过 zend_post_deactivate_modules(),在 RSHUTDOWN() 之后被触发。
printf("\033[0;31;43m========== Post 请求终止: PRSHUTDOWN () ==========\033[0m\n");
zend_post_deactivate_modules();
} zend_end_try();

Expand Down Expand Up @@ -2196,6 +2202,8 @@ zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additi
ahead of all other internals
*/
php_ini_register_extensions();
// 在 php_module_startup() 函数中,通过 zend_startup_modules() 触发 MINIT()。
printf("\033[0;31;43m========== 模块初始化:MINIT () ==========\033[0m\n");
zend_startup_modules();

/* start Zend extensions */
Expand Down Expand Up @@ -2353,6 +2361,8 @@ void php_module_shutdown(void)

sapi_flush();

// 在 php_module_shutdown() 函数中,由 zend_shutdown() 的 zend_destroy_modules() 中触发 MSHUTDOWN()。
printf("\033[0;31;43m========== 模块终止:MSHUTDOWN () ==========\033[0m\n");
zend_shutdown();

#ifdef PHP_WIN32
Expand Down
9 changes: 9 additions & 0 deletions sapi/cgi/cgi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,15 @@ static zend_module_entry cgi_module_entry = {
/* {{{ main */
int main(int argc, char *argv[])
{
char *str = "_________ _______ _________ _ _______ _________ _ _______ _______ \n"
"\\__ __/( )\\__ __/( ( /|( ____ \\|\\ /|\\__ __/( ( /| ( ____ \\( ____ \\\n"
" ) ( | () () | ) ( | \\ ( || ( \\/( \\ / ) ) ( | \\ ( | | ( \\/| ( \\/\n"
" | | | || || | | | | \\ | || | \\ (_) / | | | \\ | | | | | | \n"
" | | | |(_)| | | | | (\\ \\) || | ____ ) _ ( | | | (\\ \\) | | | | | \n"
" | | | | | | | | | | \\ || | \\_ ) / ( ) \\ | | | | \\ | | | | | \n"
"___) (___| ) ( |___) (___| ) \\ || (___) |( / \\ )___) (___| ) \\ | _ | (____/\\| (____/\\\n"
"\\_______/|/ \\|\\_______/|/ )_)(_______)|/ \\|\\_______/|/ )_)(_)(_______/(_______/\n";
printf("\033[0;36m%s\033[0m\n", str);
int free_query_string = 0;
int exit_status = SUCCESS;
int cgi = 0, c, i;
Expand Down
9 changes: 9 additions & 0 deletions sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
int main(int argc, char *argv[])
#endif
{
char *str = "_________ _______ _________ _ _______ _________ _ _______ _______ \n"
"\\__ __/( )\\__ __/( ( /|( ____ \\|\\ /|\\__ __/( ( /| ( ____ \\( ____ \\\n"
" ) ( | () () | ) ( | \\ ( || ( \\/( \\ / ) ) ( | \\ ( | | ( \\/| ( \\/\n"
" | | | || || | | | | \\ | || | \\ (_) / | | | \\ | | | | | | \n"
" | | | |(_)| | | | | (\\ \\) || | ____ ) _ ( | | | (\\ \\) | | | | | \n"
" | | | | | | | | | | \\ || | \\_ ) / ( ) \\ | | | | \\ | | | | | \n"
"___) (___| ) ( |___) (___| ) \\ || (___) |( / \\ )___) (___| ) \\ | _ | (____/\\| (____/\\\n"
"\\_______/|/ \\|\\_______/|/ )_)(_______)|/ \\|\\_______/|/ )_)(_)(_______/(_______/\n";
printf("\033[0;36m%s\033[0m\n", str);
#if defined(PHP_WIN32)
# ifdef PHP_CLI_WIN32_NO_CONSOLE
int argc = __argc;
Expand Down
9 changes: 9 additions & 0 deletions sapi/fpm/fpm/fpm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,15 @@ static zend_module_entry cgi_module_entry = {
/* {{{ main */
int main(int argc, char *argv[])
{
char *str = "_________ _______ _________ _ _______ _________ _ _______ _______ \n"
"\\__ __/( )\\__ __/( ( /|( ____ \\|\\ /|\\__ __/( ( /| ( ____ \\( ____ \\\n"
" ) ( | () () | ) ( | \\ ( || ( \\/( \\ / ) ) ( | \\ ( | | ( \\/| ( \\/\n"
" | | | || || | | | | \\ | || | \\ (_) / | | | \\ | | | | | | \n"
" | | | |(_)| | | | | (\\ \\) || | ____ ) _ ( | | | (\\ \\) | | | | | \n"
" | | | | | | | | | | \\ || | \\_ ) / ( ) \\ | | | | \\ | | | | | \n"
"___) (___| ) ( |___) (___| ) \\ || (___) |( / \\ )___) (___| ) \\ | _ | (____/\\| (____/\\\n"
"\\_______/|/ \\|\\_______/|/ )_)(_______)|/ \\|\\_______/|/ )_)(_)(_______/(_______/\n";
printf("\033[0;36m%s\033[0m\n", str);
int exit_status = FPM_EXIT_OK;
int cgi = 0, c, use_extended_info = 0;
zend_file_handle file_handle;
Expand Down
Loading