Skip to content

Stdlib: settype() on uninitialized typed property by-ref — LogicException not Error (ext/standard/type.c) #13884

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

settype($obj->prop, 'int') when $prop is an uninitialized non-nullable typed property must fail on the by-reference write with Zend's Error:

Cannot access uninitialized non-nullable property … by reference

The VM throws LogicException (settype() to integer does not support this value type in this compiler build) instead of the property-access Error.

php-src reference

Repro (verified 2026-06-30)

test/repro/maintainer_gap_settype_uninitialized_typed.php

./script/docker-exec.sh -- bash -lc '
  php test/repro/maintainer_gap_settype_uninitialized_typed.php        # exit 0, Error
  php bin/vm.php test/repro/maintainer_gap_settype_uninitialized_typed.php  # exit 255, LogicException
'
Check Zend VM
settype($o->x, "int") on uninitialized int $x Error (by-ref) LogicException (builtin)

Scope (PHP-in-PHP first)

Layer Path
VM ext/standard/settype.php (and shared scalar write helpers) — propagate typed-property by-ref Error before settype type switch
JIT after VM green

Done when

  • Repro exits 0 on VM with Zend-parity Error text
  • No LogicException on this path under php-src-strict

Activity

  1. added
    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 Jun 30, 2026
  2. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #13883, #13884, #13818)

  3. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Merged via #13889 — TypedPropertyCheck::assertWritableByReference in VmSettype for uninitialized non-nullable typed by-ref. VM + JIT compliance green.

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 machineenhancementNew 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