Skip to content

Date: createFromDateString bad-token Warning → Unexpected character (#31575) - #31587

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-31575-dateinterval-unexpected-char
Aug 16, 2026
Merged

Date: createFromDateString bad-token Warning → Unexpected character (#31575)#31587
PurHur merged 1 commit into
masterfrom
agent/issue-31575-dateinterval-unexpected-char

Conversation

@PurHur

@PurHur PurHur commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Align DateInterval::createFromDateString('@@@') Warning detail with Zend/php-src: Unexpected character instead of the timezone-database leak path.
  • Alphabetic tokens like foo still use The timezone could not be found in the database (unchanged).
  • PHP-side fix in ext/standard/VmDateInterval.php (parseFromDateString); no new runtime/ C.

Closes #31575

php-src reference

  • ext/date/php_date.czim_DateInterval_createFromDateString
  • ext/date/lib/parse_date.re — unexpected-character diagnostics

Test plan

  • Issue repro (Zend + VM)
  • ./script/phpunit.sh --filter 'Issue31575DateIntervalBadTokenWarnTest|DateIntervalCreateFromDateStringBadTokenWarn31575VMTest'
  • Related empty/null createFromDateString VM guards still green

Verification

$ ./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_dateinterval_createfromdatestring_warn.php'
return=false
warning=DateInterval::createFromDateString(): Unknown or bad format (@@@) at position 0 (@): Unexpected character

$ ./script/phpunit.sh --filter 'Issue31575DateIntervalBadTokenWarnTest|DateIntervalCreateFromDateStringBadTokenWarn31575VMTest'
OK (2 tests, 3 assertions)

Made with Cursor

…character (#31575)

Punctuation tokens like @@@ were leaking the timezone-lookup failure string; align with php-src timelib unexpected-character diagnostics under php-src-strict.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: DateInterval::createFromDateString(@@@) Warning says timezone — Zend Unexpected character (ext/date/php_date.c)

1 participant