Commit 3a3ca68
committed
fix: prevent scientific notation in timestamp on low-precision PHP environments
On PHP FPM environments with non-default precision ini settings (≤12),
casting a large float to string could produce scientific notation
(e.g. 1.78E+12) instead of a plain integer, causing Yoti signature
verification to fail with 401 MESSAGE_SIGNING.
Replace (string)(round(microtime(true) * 1000)) with
sprintf('%.0F', microtime(true) * 1000) which forces a plain decimal
string regardless of the precision ini setting, and drops the redundant
round() since %.0F already rounds to zero decimal places.
Tests added to verify plain integer output under precision=12 and
precision=8 (via @dataProvider), and to assert the timestamp falls
within the correct Unix-millisecond range under low precision without
masking scientific notation via an early (int) cast.
Fixes #4171 parent d4cc170 commit 3a3ca68
2 files changed
Lines changed: 63 additions & 1 deletion
File tree
- src/Http/AuthStrategy
- tests/Http/AuthStrategy
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
71 | 133 | | |
72 | 134 | | |
73 | 135 | | |
| |||
0 commit comments