Repository navigation
Commit bed0a3a
Date/Time: Return false from wp_date() when the timestamp cannot be parsed.
`wp_date()` only checked the timestamp with `is_numeric()`, which accepts
values that `date_create( '@' . $timestamp )` rejects, such as `'1e3'`, `1e20`,
`' 5'`, and `'.5'`. For those, `date_create()` returned false and the following
`setTimezone()` call caused a fatal error. Now false is returned, as documented
for invalid timestamp input and as already done for non-numeric input.
This also resolves the PHPStan `method.nonObject` errors on every use of
`$datetime` in the function.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent fbd1a8e commit bed0a3a
2 files changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
261 | 266 | | |
262 | 267 | | |
263 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
37 | 63 | | |
38 | 64 | | |
39 | 65 | | |
| |||
0 commit comments