Merge branch 'PHP-8.1' into PHP-8.2

This commit is contained in:
Jakub Zelenka 2023-02-05 13:10:19 +00:00
commit 2b71fa6952
No known key found for this signature in database
GPG Key ID: 1C0779DC5C0A9DE4
4 changed files with 18 additions and 10 deletions

1
NEWS
View File

@ -22,6 +22,7 @@ PHP NEWS
- FPM: - FPM:
. Fixed bug GH-10315 (FPM unknown child alert not valid). (Jakub Zelenka) . Fixed bug GH-10315 (FPM unknown child alert not valid). (Jakub Zelenka)
. Fixed bug GH-10385 (FPM successful config test early exit). (nielsdos)
- GMP: - GMP:
. Properly implement GMP::__construct(). (nielsdos) . Properly implement GMP::__construct(). (nielsdos)

View File

@ -41,7 +41,7 @@ struct fpm_globals_s fpm_globals = {
.send_config_pipe = {0, 0}, .send_config_pipe = {0, 0},
}; };
int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root, int force_daemon, int force_stderr) /* {{{ */ enum fpm_init_return_status fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root, int force_daemon, int force_stderr) /* {{{ */
{ {
fpm_globals.argc = argc; fpm_globals.argc = argc;
fpm_globals.argv = argv; fpm_globals.argv = argv;
@ -67,22 +67,22 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t
0 > fpm_event_init_main()) { 0 > fpm_event_init_main()) {
if (fpm_globals.test_successful) { if (fpm_globals.test_successful) {
exit(FPM_EXIT_OK); return FPM_INIT_EXIT_OK;
} else { } else {
zlog(ZLOG_ERROR, "FPM initialization failed"); zlog(ZLOG_ERROR, "FPM initialization failed");
return -1; return FPM_INIT_ERROR;
} }
} }
if (0 > fpm_conf_write_pid()) { if (0 > fpm_conf_write_pid()) {
zlog(ZLOG_ERROR, "FPM initialization failed"); zlog(ZLOG_ERROR, "FPM initialization failed");
return -1; return FPM_INIT_ERROR;
} }
fpm_stdio_init_final(); fpm_stdio_init_final();
zlog(ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid); zlog(ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid);
return 0; return FPM_INIT_CONTINUE;
} }
/* }}} */ /* }}} */

View File

@ -34,8 +34,14 @@
#endif #endif
enum fpm_init_return_status {
FPM_INIT_ERROR,
FPM_INIT_CONTINUE,
FPM_INIT_EXIT_OK,
};
int fpm_run(int *max_requests); int fpm_run(int *max_requests);
int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root, int force_daemon, int force_stderr); enum fpm_init_return_status fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root, int force_daemon, int force_stderr);
struct fpm_globals_s { struct fpm_globals_s {
pid_t parent_pid; pid_t parent_pid;

View File

@ -1537,7 +1537,6 @@ int main(int argc, char *argv[])
int force_stderr = 0; int force_stderr = 0;
int php_information = 0; int php_information = 0;
int php_allow_to_run_as_root = 0; int php_allow_to_run_as_root = 0;
int ret;
#if ZEND_RC_DEBUG #if ZEND_RC_DEBUG
bool old_rc_debug; bool old_rc_debug;
#endif #endif
@ -1784,14 +1783,13 @@ consult the installation file that came with this distribution, or visit \n\
zend_rc_debug = 0; zend_rc_debug = 0;
#endif #endif
ret = fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root, force_daemon, force_stderr); enum fpm_init_return_status ret = fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root, force_daemon, force_stderr);
#if ZEND_RC_DEBUG #if ZEND_RC_DEBUG
zend_rc_debug = old_rc_debug; zend_rc_debug = old_rc_debug;
#endif #endif
if (ret < 0) { if (ret == FPM_INIT_ERROR) {
if (fpm_globals.send_config_pipe[1]) { if (fpm_globals.send_config_pipe[1]) {
int writeval = 0; int writeval = 0;
zlog(ZLOG_DEBUG, "Sending \"0\" (error) to parent via fd=%d", fpm_globals.send_config_pipe[1]); zlog(ZLOG_DEBUG, "Sending \"0\" (error) to parent via fd=%d", fpm_globals.send_config_pipe[1]);
@ -1800,6 +1798,9 @@ consult the installation file that came with this distribution, or visit \n\
} }
exit_status = FPM_EXIT_CONFIG; exit_status = FPM_EXIT_CONFIG;
goto out; goto out;
} else if (ret == FPM_INIT_EXIT_OK) {
exit_status = FPM_EXIT_OK;
goto out;
} }
if (fpm_globals.send_config_pipe[1]) { if (fpm_globals.send_config_pipe[1]) {