Skip to content

Tests/coverage expansion#33

Merged
EdmondDantes merged 3 commits into
mainfrom
tests/coverage-expansion
May 20, 2026
Merged

Tests/coverage expansion#33
EdmondDantes merged 3 commits into
mainfrom
tests/coverage-expansion

Conversation

@EdmondDantes
Copy link
Copy Markdown
Contributor

No description provided.

http_static_handler_freeze() initialised the persistent extra_headers
and mime_overrides HashTables with ZVAL_PTR_DTOR while filling them with
persistent zend_strings. ZVAL_PTR_DTOR routes through zend_string_destroy,
which asserts the string is non-persistent — SIGABRT at HttpServer
teardown (heap corruption in release builds). Triggered whenever
StaticHandler::setHeader()/setMimeType() runs on a handler attached via
HttpServer::addStaticHandler() (the path that calls freeze).

Use a custom persistent_str_zval_dtor that releases values through
zend_string_release_ex(s, persistent=1).

Also add 20 phpt tests expanding coverage: multipart parsing edge cases
and error paths, static-handler validation/lifecycle, server config
validation, response reason phrases and end-to-end HTTP methods.
HttpServer::start() now binds AF_UNIX listeners added via
HttpServerConfig::addUnixListener() — previously the config accepted the
path but start() had a TODO and never bound it (a unix-only config died
with "No valid listeners").

Single-worker servers bind the path directly. With workers > 1 the pool
parent binds each AF_UNIX socket once (AF_UNIX has no SO_REUSEPORT, so
per-worker independent binds are impossible) and shares the fd with every
worker; each worker adopts a dup via ZEND_ASYNC_SOCKET_LISTEN_FD. Stale
socket files from a crashed run are probed and unlinked; the bound path
is unlinked on teardown.

Tests: 038 (single worker round-trip) and 039 (workers > 1 shared fd).
@github-actions
Copy link
Copy Markdown
Contributor

Coverage

Total lines: 77.11% → 80.90% (+3.78 pp)

File Baseline Current Δ Touched
src/core/http_protocol_handlers.c 71.88% 75.00% +3.12 pp
src/formats/multipart_parser.c 65.16% 79.92% +14.75 pp
src/formats/multipart_processor.c 75.38% 86.46% +11.08 pp
src/http1/http_parser.c 76.67% 77.06% +0.39 pp
src/http_date.c 76.34% 98.92% +22.58 pp
src/http_mime.c 89.80% 97.96% +8.16 pp
src/http_response.c 84.49% 88.21% +3.72 pp
src/http_rfc5987.c 0.00% 97.06% +97.06 pp
src/http_send_file.c 82.80% 84.95% +2.15 pp
src/http_send_file_options.c 89.06% 89.84% +0.78 pp
src/http_server_class.c 74.79% 72.17% -2.62 pp
src/http_server_config.c 84.11% 94.98% +10.87 pp
src/send_file.c 84.24% 86.97% +2.73 pp
src/static/http_static.c 82.45% 86.53% +4.08 pp
src/static/http_static_path.c 94.62% 98.92% +4.30 pp
src/static/static_handler_class.c 49.80% 96.85% +47.05 pp
src/uploaded_file.c 75.00% 83.70% +8.70 pp

❌ Regression in touched files (> 1.0 pp drop)

  • src/http_server_class.c dropped -2.62 pp

Add [coverage-drop-ok] to a commit message in this PR to override.

@EdmondDantes EdmondDantes merged commit f9a9fc8 into main May 20, 2026
5 checks passed
@EdmondDantes EdmondDantes deleted the tests/coverage-expansion branch May 20, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant