Skip to content

Commit

Permalink
sync php-8.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Nov 15, 2022
1 parent 65d4dac commit 77c1a7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion sapi/cli/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ if test "$PHP_CLI" != "no"; then
PHP_SUBST(BUILD_CLI)

PHP_OUTPUT(sapi/cli/php.1)

PHP_INSTALL_HEADERS([sapi/cli/cli.h])
fi
AC_MSG_RESULT($PHP_CLI)
16 changes: 7 additions & 9 deletions sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const opt_struct OPTIONS[] = {
{'l', 0, "syntax-check"},
{'m', 0, "modules"},
{'n', 0, "no-php-ini"},
{'P', 0, "fpm"},
{'P', 0, "fpm"},
{'q', 0, "no-header"}, /* for compatibility with CGI (do not generate HTTP headers) */
{'R', 1, "process-code"},
{'H', 0, "hide-args"},
Expand Down Expand Up @@ -541,21 +541,19 @@ static void cli_register_file_handles(bool no_close) /* {{{ */
s_out = php_stream_open_wrapper_ex("php://stdout", "wb", 0, NULL, sc_out);
s_err = php_stream_open_wrapper_ex("php://stderr", "wb", 0, NULL, sc_err);

/* Release stream resources, but don't free the underlying handles. Othewrise,
* extensions which write to stderr or company during mshutdown/gshutdown
* won't have the expected functionality.
*/
if (s_in) s_in->flags |= PHP_STREAM_FLAG_NO_CLOSE;
if (s_out) s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;
if (s_err) s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE;

if (s_in==NULL || s_out==NULL || s_err==NULL) {
if (s_in) php_stream_close(s_in);
if (s_out) php_stream_close(s_out);
if (s_err) php_stream_close(s_err);
return;
}

if (no_close) {
s_in->flags |= PHP_STREAM_FLAG_NO_CLOSE;
s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;
s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE;
}

s_in_process = s_in;

php_stream_to_zval(s_in, &ic.value);
Expand Down
10 changes: 3 additions & 7 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,7 @@ static void php_cli_server_dtor(php_cli_server *server) /* {{{ */
!WIFSIGNALED(php_cli_server_worker_status));
}

free(php_cli_server_workers);
pefree(php_cli_server_workers, 1);
}
#endif
} /* }}} */
Expand Down Expand Up @@ -2382,12 +2382,8 @@ static void php_cli_server_startup_workers(void) {
if (php_cli_server_workers_max > 1) {
zend_long php_cli_server_worker;

php_cli_server_workers = calloc(
php_cli_server_workers_max, sizeof(pid_t));
if (!php_cli_server_workers) {
php_cli_server_workers_max = 1;
return;
}
php_cli_server_workers = pecalloc(
php_cli_server_workers_max, sizeof(pid_t), 1);

php_cli_server_master = getpid();

Expand Down

0 comments on commit 77c1a7b

Please sign in to comment.