Skip to content

Fix GH-7781: CLI server prints HTML in startup warnings - #23269

Open
matthiasgoergens wants to merge 1 commit into
php:masterfrom
matthiasgoergens:gh7781-cli-server-html-errors
Open

Fix GH-7781: CLI server prints HTML in startup warnings#23269
matthiasgoergens wants to merge 1 commit into
php:masterfrom
matthiasgoergens:gh7781-cli-server-html-errors

Conversation

@matthiasgoergens

Copy link
Copy Markdown
Contributor

The CLI server formats startup diagnostics with request-time HTML error
formatting, so resolver warnings show <br> markup in the terminal. Temporarily
disable html_errors while constructing the server.

Comment thread sapi/cli/php_cli_server.c
@@ -2907,7 +2870,12 @@ int do_cli_server(int argc, char **argv) /* {{{ */
router = argv[php_optind];
}

if (FAILURE == php_cli_server_ctor(&server, server_bind_address, document_root, router)) {
/* Startup diagnostics are written to a terminal, not an HTTP response. */
html_errors = PG(html_errors);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not acting on display_errors instead ? e.g.

     ...
     uint8_t display_errors = PG(display_errors);
     PG(display_errors) = 0;
     /// note: php_cli_server_ctor() reports its own failures through php_cli_server_logf()
     server_ctor_result = php_cli_server_ctor(&server, server_bind_address, document_root, router);
     PG(display_errors) = display_errors;
     ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants