Skip to content

Regression: var_export() on __set_state() return — NULL not export string (ext/standard/var.c) #13810

Closed

Description

@PurHur

Category

stdlib · php-src-strict · regression

Problem

var_export(SomeClass::__set_state([]), true) must return a reconstructable export string (e.g. \SomeClass::__set_state(array(...))). On this compiler the call returns NULL / string 'NULL' instead.

Zend: ext/standard/var.c — php_var_export() object branch with __set_state.

php-src reference

Repro (verified 2026-06-29)

test/repro/maintainer_gap_var_export_set_state_return.php

php bin/vm.php test/repro/maintainer_gap_var_export_set_state_return.php
Check Zend VM
var_export(C::__set_state([]), true) contains __set_state(array yes NULL

Scope (PHP-in-PHP first)

Layer Path
VM ext/standard/var_export.php, ext/standard/VmVar.php (or equivalent export helper)
JIT/AOT shared export path after VM green

Distinct from #4854 (__debugInfo hook).

Done when (php-src-strict)

  • Repro exits 0 on VM
  • var_export() on any object with __set_state matches Zend format
  • JIT/AOT agree when in scope

Verification

php bin/vm.php test/repro/maintainer_gap_var_export_set_state_return.php
php bin/vm.php test/repro/maintainer_gap_var_export_set_state.php

Links

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

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #13812, #13811, #13810)

  3. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    Verified on master 2026-06-29: var_export(C::__set_state([]), true) returns export string on VM+AOT — appears already fixed via prior var_export work.

  4. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — batch (issues #14103, #13810)

  5. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Pivoting batch to #13722 — #13810 root cause is inline StaticCall temp lifetime in builtin arg position (not var_export formatter); deferring to compiler dead-operand pass.

  6. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — batch (issue #13810)

  7. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Merged #14153 — var_export(VE::__set_state([]), true) now wires hoisted StaticCall producer slot (dead-temp fallback extended beyond FuncCall). Verification: repro + InlineCallArgProducerSlotTest + var_export_set_state_inline.phpt green in Docker.

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