Skip to content

Regression: var_export($expr !== false, true) returns NULL — false literal misread as return flag (re-#13694, lib/Compiler.php) #17250

Closed

Description

@PurHur

Category

Regression · php-src-strict · compile inline-arg wiring

Problem

var_dump($x !== false) was fixed in #13694, but var_export($expr !== false, true) still mis-compiles on master (2026-07-07): php-cfg hoists the false literal and the consumer pass treats it as var_export()’s return-mode flag instead of the comparison operand. Zend exports the boolean result; this compiler returns NULL, exports the LHS value, or prints the wrong boolean for loose != false.

Repro Zend 8.2+ VM (2026-07-07)
var_export(1 !== false, true) true NULL
var_export(1 != false, true) true false
var_export([1] !== false, true) true NULL / exports [1]
var_export(@getimagesize(...) !== false, true) true exports imageinfo array
var_export(array_search('x',$a,true)!==false,true) true NULL

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_var_export_neq_false.php'

Done when

  • test/repro/maintainer_gap_var_export_neq_false.php prints five true/false lines then ok on VM/JIT/AOT
  • Compliance .phpt guard under test/compliance/cases/stdlib/var_export_comparison_neq_false.phpt
  • InlineCallArgProducerSlotTest var_export comparison cases green
  • 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 7, 2026
  2. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

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

  3. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    Merged via #17254.

    Fix: Extended inline call-arg producer matching in lib/Compiler.php so hoisted false in !==/!= comparisons feeds the comparison RHS (not var_export's return flag), mirroring #13694 (var_dump) and #17210 (arithmetic).

    Verification:

    • php bin/vm.php test/repro/maintainer_gap_var_export_neq_false.php → five bool lines + ok
    • InlineCallArgProducerSlotTest::testVarExportNotIdenticalFalseReturnTrueUsesComparisonProducerSlot green
    • test/compliance/cases/stdlib/var_export_comparison_neq_false.phpt green (VM/JIT/AOT)
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:compilerCompiler / CFG / JITarea: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