Repository navigation
fix(docker): set PHP precision to -1 so floats keep every digit - #14381
Conversation
PDO casts a float bound as a string, and a float8 that pdo_pgsql fetches under ATTR_STRINGIFY_FETCHES, with PHP's precision setting. At the default of 14 digits a float column stored 1234567.123456789 as 1234567.1234568, and a stored double was read back cut to 14 digits as well. -1 uses the shortest representation that round-trips.
|
Review complete. No blocking issues — approved ✅; 2 nitpicks below. 🧹 Nitpicks (2) — 🟢 2 low
This PR ships the image with
Reviewed commit: 2676a6f |
Security rulesNo new WARNING or ERROR findings from security rules. 32 existing findings tracked in
|
🟢 Tier S · Ready to mergeThe Docker image now configures PHP with
📂 Walkthrough · 3
Reviewed |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
fix(docker): set PHP precision to -1 so floats keep every digit (cherry picked from commit 66e93de)
What changed
precisionto-1(docker/php.ini, copied intoconf.d). PDO converts a float to a string with this setting in two places: when a float is bound as a string on write, and when pdo_pgsql fetches afloat8underATTR_STRINGIFY_FETCHES. At the default of 14 digits, both cut doubles short. With-1, PHP uses the shortest string that round-trips.testCreateDocumentFloatPrecision: it writes1234567.123456789to a float column and reads it back.Tested
On the local Postgres stack, with a sidecar API container:
1234567.1234568and read back as that value. A row stored with all its digits also lists as1234567.1234568,0.3and1.7976931348623e+308. The new test fails:1234567.1234568 is identical to 1234567.123456789.1234567.123456789,0.30000000000000004,1.7976931348623157e+308and the point[13.40495412345679, 52.52000812345678]are stored and returned exactly.LegacyCustomServerTestwith the ini:testCreateDocumentFloatPrecision,testInvalidDocumentStructure,testSpatialPointAttributes,testIncrementAttribute,testDecrementAttribute,testAttributeResponseModelsandtestCreateCollectionInlineNumericRangeall pass.Fixes #14220