Fix GH-17956 Internal dev server 404 page is not responsive

Add a basic viewport html meta tag with responsive mode parameters
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag

Updated existing tests

close GH-17957
This commit is contained in:
Pascal Chevrel 2025-03-02 14:08:28 +01:00 committed by David Carlier
parent 0097ad8eb3
commit ff88701b77
No known key found for this signature in database
GPG key ID: 2FB76A8CE6CD2B41
3 changed files with 8 additions and 6 deletions

2
NEWS
View file

@ -6,6 +6,8 @@ PHP NEWS
. Extended --ini to print INI settings changed from the builtin default. . Extended --ini to print INI settings changed from the builtin default.
(timwolla) (timwolla)
. Drop support for -z CLI/CGI flag. (nielsdos) . Drop support for -z CLI/CGI flag. (nielsdos)
. Fixed GH-17956 - development server 404 page does not adapt to mobiles.
(pascalchevrel)
- COM: - COM:
. Fixed property access of PHP objects wrapped in variant. (cmb) . Fixed property access of PHP objects wrapped in variant. (cmb)

View file

@ -2026,7 +2026,7 @@ static zend_result php_cli_server_send_error_page(php_cli_server *server, php_cl
escaped_request_uri = php_escape_html_entities_ex((const unsigned char *) ZSTR_VAL(client->request.request_uri), ZSTR_LEN(client->request.request_uri), 0, ENT_QUOTES, NULL, /* double_encode */ 0, /* quiet */ 0); escaped_request_uri = php_escape_html_entities_ex((const unsigned char *) ZSTR_VAL(client->request.request_uri), ZSTR_LEN(client->request.request_uri), 0, ENT_QUOTES, NULL, /* double_encode */ 0, /* quiet */ 0);
{ {
static const char prologue_template[] = "<!doctype html><html><head><title>%d %s</title>"; static const char prologue_template[] = "<!doctype html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><title>%d %s</title>";
php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(prologue_template) + 3 + strlen(status_string) + 1); php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(prologue_template) + 3 + strlen(status_string) + 1);
if (!chunk) { if (!chunk) {
goto fail; goto fail;

View file

@ -131,7 +131,7 @@ X-Powered-By: PHP/%s
Content-Type: text/html; charset=UTF-8 Content-Type: text/html; charset=UTF-8
Content-Length: %d Content-Length: %d
<!doctype html><html><head><title>404 Not Found</title><style>AAA</style> <!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1"><title>404 Not Found</title><style>AAA</style>
</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/</code> was not found on this server.</p></body></html> </head><body><h1>Not Found</h1><p>The requested resource <code class="url">/</code> was not found on this server.</p></body></html>
HTTP/1.1 404 Not Found HTTP/1.1 404 Not Found
Host: %s Host: %s
@ -141,7 +141,7 @@ X-Powered-By: PHP/%s
Content-Type: text/html; charset=UTF-8 Content-Type: text/html; charset=UTF-8
Content-Length: %d Content-Length: %d
<!doctype html><html><head><title>404 Not Found</title><style>AAA</style> <!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1"><title>404 Not Found</title><style>AAA</style>
</head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/style.css</code> was not found on this server.</p></body></html> </head><body><h1>Not Found</h1><p>The requested resource <code class="url">/main/style.css</code> was not found on this server.</p></body></html>
HTTP/1.1 404 Not Found HTTP/1.1 404 Not Found
Host: %s Host: %s
@ -161,7 +161,7 @@ Content-Type: text/html; charset=UTF-8
Content-Length: %d Content-Length: %d
Allow: GET, HEAD, POST Allow: GET, HEAD, POST
<!doctype html><html><head><title>405 Method Not Allowed</title><style>AAA</style> <!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1"><title>405 Method Not Allowed</title><style>AAA</style>
</head><body><h1>Method Not Allowed</h1><p>Requested method not allowed.</p></body></html> </head><body><h1>Method Not Allowed</h1><p>Requested method not allowed.</p></body></html>
HTTP/1.1 405 Method Not Allowed HTTP/1.1 405 Method Not Allowed
Host: %s Host: %s
@ -172,7 +172,7 @@ Content-Type: text/html; charset=UTF-8
Content-Length: %d Content-Length: %d
Allow: GET, HEAD, POST Allow: GET, HEAD, POST
<!doctype html><html><head><title>405 Method Not Allowed</title><style>AAA</style> <!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1"><title>405 Method Not Allowed</title><style>AAA</style>
</head><body><h1>Method Not Allowed</h1><p>Requested method not allowed.</p></body></html> </head><body><h1>Method Not Allowed</h1><p>Requested method not allowed.</p></body></html>
HTTP/1.1 405 Method Not Allowed HTTP/1.1 405 Method Not Allowed
Host: %s Host: %s
@ -183,5 +183,5 @@ Content-Type: text/html; charset=UTF-8
Content-Length: %d Content-Length: %d
Allow: GET, HEAD, POST Allow: GET, HEAD, POST
<!doctype html><html><head><title>405 Method Not Allowed</title><style>AAA</style> <!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1"><title>405 Method Not Allowed</title><style>AAA</style>
</head><body><h1>Method Not Allowed</h1><p>Requested method not allowed.</p></body></html> </head><body><h1>Method Not Allowed</h1><p>Requested method not allowed.</p></body></html>