Repository navigation
Conversation
The test fills every heap page and expects mlog() to hit the memory limit inside php_verror(). The testing mlog() clamped messages to 500 bytes, and %.*s precision is capped at 500 before PHP 8.1 anyway. PHP 7.3+ grows the format buffer in whole pages, but 7.0-7.2 grow it by len + 128, so the buffer came from a small bin. The limit was then only hit when that bin had no free slot, which depends on the environment and test path. Format the testing message with %s and log 4 KiB. That is above the largest small bin (3 KiB), so php_verror() needs new pages and reaches the limit on every version.
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 91d5378 | Docs | View more details | Give us feedback! |
Benchmarks [ appsec ]Benchmark execution time: 2026-10-28 17:52:08 Comparing candidate commit 91d5378 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics.
|
Description
logging_memory_limit.phpt(#4361) failed randomly on PHP 7.0–7.2. The testingmlog()clamped messages to 500 bytes (and%.*sprecision is capped at 500 before PHP 8.1). On 7.0–7.2 the resultingphp_verror()buffer fits a small-bin slot, so hitting the memory limit depended on leftover heap state, which varies with the CI job's environment variables and the test path.The test now logs a 4 KiB message, which needs a new page on every PHP version, and the testing
mlog()formats it with%sso nothing truncates it. Assertions are unchanged.Reviewer checklist