Skip to content

Regression: filter_var() FILTER_VALIDATE_INT accepts overflow string past PHP_INT_MAX (ext/filter/logical_filters.c) #17585

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

FILTER_VALIDATE_INT must reject decimal strings whose numeric value exceeds PHP_INT_MAX. Zend returns false; this compiler coerces/truncates and returns 9223372036854775807 (on 64-bit).

Repro Zend 8.2+ VM (2026-07-10)
filter_var(PHP_INT_MAX.'0', FILTER_VALIDATE_INT) false 9223372036854775807
filter_var('0123', FILTER_VALIDATE_INT) false false (ok)

php-src reference

PHP implementation target

  • ext/filter/ VM implementation (PHP) — mirror Zend overflow rejection; share guards with any JIT lowering in lib/JIT/

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_filter_validate_int_overflow.php'
# fail: overflow int validated as 9223372036854775807

Done when

  • maintainer_gap_filter_validate_int_overflow.php prints ok on VM/JIT/AOT
  • Compliance .phpt under test/compliance/cases/stdlib/filter_validate_int_overflow.phpt
  • php-src-strict; no php-compiler-strict shortcut

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-c — starting this run

  3. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    Merged via #17593.

    Fix: parseDecimalIntegerString() in ext/filter/VmFilter.php — decimal strings whose magnitude exceeds native int bounds now return false (php-src ext/filter/logical_filters.c parity). PHP_INT_MIN handled as a direct edge case.

    Verification:
    ```bash
    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_filter_validate_int_overflow.php'

    ok

    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter VmFilterTest'

    OK (42 tests)

    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter filter_validate_int_overflow'

    OK (2 tests)

    ```

  4. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — starting this run (#17585 FILTER_VALIDATE_INT overflow rejection in ext/filter/VmFilter.php).

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