Skip to content

Regression: microtime(null) under declare(strict_types=1) — VM coerces, Zend TypeError (ext/standard/microtime.c) #17049

Closed

Description

@PurHur

Category

stdlib · null operand under user strict_types · php-src-strict

Problem

With declare(strict_types=1) in the compile unit, Zend rejects microtime(null) with TypeError. This compiler coerces null and returns a timestamp string via typed-string lowering that ignores strict_types for the builtin boundary.

Repro Zend 8.2 VM (2026-07-07)
microtime(null) in strict file TypeError returns "0.xxxxxxxx N"

php-src reference

PHP implementation target

  • ext/standard/microtime.php (or equivalent VM builtin) — honor Frame::calledInStrictTypes() / shared VmString::coerceTypedStringBuiltinArg() for nullable $as_float when operand is null
  • lib/JIT/Builtin/ microtime lowering — mirror strict_types branch in JIT/AOT

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_microtime_null_strict.php'
# fail: expected TypeError (wrong) · Zend: ok

Done when

  • microtime(null) in a strict_types unit throws TypeError on VM/JIT/AOT
  • Non-strict microtime(null) behavior unchanged (coerce/default)
  • Compliance guard under test/compliance/cases/stdlib/
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    enhancementNew feature or request
    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 7, 2026
  2. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch strict_types null operands (#17050, #17051, #17049, #17052)

  3. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    Merged in #17053. VM+JIT compliance green for strict_types null TypeError on password_hash/verify, microtime, date_create_from_format; non-strict coercion regressions (password_hash_null_password_coerce, microtime_null_coerce) still pass.

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 workingenhancementNew feature or requestimplementation-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