Skip to content

Stdlib: mb_strlen() string:/encoding: named parameters rejected (ext/mbstring/mbstring.c) #10044

Description

@PurHur

Category

stdlib · php-src-strict

Problem

php-src names mb_strlen() parameters string and encoding. Zend accepts:

mb_strlen(string: 'é', encoding: 'UTF-8'); // int(1)

VM rejects with Unknown named parameter $string. Positional mb_strlen('é', 'UTF-8') works.

php-src reference

Repro (failure today)

<?php
echo mb_strlen(string: 'é', encoding: 'UTF-8'), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php                        # Zend: 1
php bin/vm.php repro.php               # Fatal: Unknown named parameter $string
'
Call Zend PHP 8.2+ VM today
mb_strlen(string: 'é', encoding: 'UTF-8') 1 fatal ❌
positional 1 1

Scope (this repo)

Path Work
lib/BuiltinParamNames.php / patches Register string/encoding for mb_strlen
lib/Compiler.php, lib/VM/NamedArgs.php, lib/JIT/NamedArgs.php Named binding
ext/types/mb_strlen.php or ext/mbstring/ handler after wiring
Tests test/compliance/cases/stdlib/mb_strlen_named.phpt

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

Done when

  • Repro prints 1 on VM (php-src-strict)
  • Omitted encoding: uses internal encoding like positional form
  • ./script/ci-fast.sh --filter mb_strlen_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