Skip to content

Stdlib: file_get_contents() filename: named parameter rejected (ext/standard/file.c) #10045

Description

@PurHur

Category

stdlib · php-src-strict

Problem

php-src names the first parameter of file_get_contents() filename. Zend accepts:

file_get_contents(filename: 'php://memory'); // string (possibly empty)

VM rejects with Unknown named parameter $filename. Positional file_get_contents('php://memory') works.

Distinct from #9308 (offset/length slice semantics — verified green on master 2026-06-19).

php-src reference

Repro (failure today)

<?php
var_export(file_get_contents(filename: 'php://memory'));
echo "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php
php bin/vm.php repro.php
# VM: Unknown named parameter $filename
'
Call Zend PHP 8.2+ VM today
file_get_contents(filename: 'php://memory') '' fatal ❌
positional '' ''

Scope (this repo)

Path Work
lib/BuiltinParamNames.php / patches Register filename + optional arg names
lib/Compiler.php, lib/VM/NamedArgs.php, lib/JIT/NamedArgs.php Named binding
ext/standard/file_get_contents.php handler after wiring
Tests test/compliance/cases/stdlib/file_get_contents_filename_named.phpt

PHP-in-PHP first — no new runtime/*.c.

Done when

  • Repro runs without fatal on VM
  • Named context: / offset: / length: bind to correct slots when added in follow-up
  • ./script/ci-fast.sh --filter file_get_contents_filename_named green

Related

Activity

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