Skip to content

Regression: array_multisort() inline non-empty array literal — by-ref Error not Zend success (ext/standard/array.c) #12017

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

array_multisort() with an inline non-empty array literal must succeed like Zend — php-src copies/sorts ephemeral arrays for inline operands. This compiler rejects the call:

Error: array_multisort(): Argument #1 ($param1) cannot be passed by reference

Related #9362 (empty [] literal) but distinct: non-empty [1,2] and multi-array array_multisort([1,2], [2,1]) also fail on VM while Zend prints ok.

Call Zend VM
array_multisort([1, 2], SORT_DESC, SORT_NUMERIC) success by-ref Error ❌
array_multisort([1, 2], [2, 1]) success by-ref Error ❌
$a=[1,2]; array_multisort($a, SORT_DESC) success success ✓

php-src reference

PHP implementation today

  • ext/standard/array_multisort.php, compiler by-ref actualization for variadic builtins

Repro

  • test/repro/maintainer_gap_array_multisort_inline_array_flags.php
  • test/repro/maintainer_gap_array_multisort_two_inline_arrays.php
./script/docker-exec.sh -- php test/repro/maintainer_gap_array_multisort_inline_array_flags.php   # Zend: ok
./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_array_multisort_inline_array_flags.php  # VM: Error

Implementation hints (PHP-in-PHP)

Done when

  • Both repro scripts print ok on VM
  • sort([1,2]) / ksort([1=>2]) still correctly reject by-ref Error (only array_multisort is special)
  • Targeted compliance guard committed

Refs #1492, #9362, #9076.

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

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #12018, #12017)

  3. PurHur commented on Jun 26, 2026

    @PurHur
    OwnerAuthor

    Merged via #12023. Inline array_multisort() literals green on VM + JIT + AOT compile-only guard.

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