Commit e4c32e0
committed
bug #62350 [ExpressionLanguage] Compile numbers with var_export in Compiler::repr for thread-safety (yoeunes)
This PR was merged into the 6.4 branch.
Discussion
----------
[ExpressionLanguage] Compile numbers with var_export in Compiler::repr for thread-safety
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | -
| License | MIT
This PR suggests replacing the `setlocale()` logic in `Compiler::repr()` with `var_export()` when compiling numbers.
The current use of `setlocale()` is not thread-safe and can cause race conditions in concurrent environments (e.g., Swoole, RoadRunner).
`var_export()` is locale-independent, thread-safe, and correctly handles all required float formats (`3.3`, `42.0`, `1.0E-6`, `INF`, `NAN`), as confirmed by the expanded test suite.
Commits
-------
0d1aba8 [ExpressionLanguage] Compile numbers with var_export in Compiler::repr for thread-safetyFile tree
2 files changed
+28
-9
lines changed- src/Symfony/Component/ExpressionLanguage
- Tests/Node
2 files changed
+28
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 117 | + | |
126 | 118 | | |
127 | 119 | | |
128 | 120 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
39 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
40 | 66 | | |
| 67 | + | |
41 | 68 | | |
42 | 69 | | |
43 | 70 | | |
| |||
0 commit comments