Skip to content

Regression: strtotime() natural-language relative phrases return false (re-#15058, ext/date/lib/parse_date.re) #17586

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

English relative date phrases that Zend parses via parse_date.re return false here, breaking downstream date() calls (TypeError on bool timestamp). Closed #15058 / #14151 covered similar gaps; this repro is still red on master (2026-07-10).

Repro Zend 8.2+ VM (2026-07-10)
strtotime('last year January 1') unix timestamp (e.g. 1735689600 in Jul 2026 env) false
date('Y', strtotime('last year January 1')) '2025' TypeError (bool timestamp)

php-src reference

PHP implementation target

  • ext/date/ procedural strtotime() / shared parse helpers in PHP — port relative-phrase rules from parse_date.re; avoid growing runtime/ C tables

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_strtotime_relative_phrase.php'
# fail: strtotime('last year January 1') returned false

Done when

Activity

  1. added
    bugSomething isn't working
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 10, 2026
  2. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-a — starting this run

  3. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    Merged via #17588.

    Fix: VmDateTimeNative now parses last|next|this year (bare and with English month/day) per parse_date.re.

    Verification:

    • php bin/vm.php test/repro/maintainer_gap_strtotime_relative_phrase.php → ok
    • vendor/bin/phpunit --filter strtotime_relative_phrase → OK (4 tests)
    • DateTime::modify('last year January 1') on 2020-01-15 base → 2019-01-01 00:00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions