Skip to content

Regression: pack() nested call operand — empty string / null not packed bytes (ext/standard/pack.c, re-#11313) #11365

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

When pack() is used as a nested call operand (return value passed directly to another callee such as strlen() or bin2hex()), the VM loses the packed byte string. Assignment to a variable works; nested use does not — same operand-pipeline class as #11313 / #11338.

php-src reference

Repro (verified 2026-06-24)

test/repro-maintainer/parity_pack_nested_call_operand.php

php test/repro-maintainer/parity_pack_nested_call_operand.php
php bin/vm.php test/repro-maintainer/parity_pack_nested_call_operand.php
Check Zend VM today
$p = pack('C', 0); strlen($p) assign_len=1 assign_len=1 ✓
strlen(pack('C', 0)) nested_len=1 empty / TypeError under strict_types ❌
bin2hex(pack('C', 255)) bin2hex_nested=ff empty ❌

PackEngine::pack() itself is correct when invoked from host PHP; failure is in VM nested-call return propagation.

Implementation hints (PHP-in-PHP)

Done when (php-src-strict)

Related

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

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #11313, #11365, #11366)

  3. PurHur commented on Jun 24, 2026

    @PurHur
    OwnerAuthor

    Triage 2026-06-24: repro passes on current master (VM matches Zend for nested pack/hex2bin operands). No code change needed — please close if maintainer confirms.

  4. PurHur commented on Jun 28, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — batch (issues #11365, #11655, #13079)

  5. PurHur commented on Jun 28, 2026

    @PurHur
    OwnerAuthor

    Merged #13162 — assign-expr call operands (strlen(($q = pack('C', 0)))) now wire through assign.result; repro + compliance green on VM.

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