Skip to content

Stdlib: localeconv() — decimal_point/thousands_sep/currency_symbol NULL not locale strings (ext/standard/locale.c) #11603

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

localeconv() returns an array shape but numeric formatting fields are NULL instead of the C-library locale strings Zend exposes (decimal_point '.', thousands_sep '', currency_symbol '' in C locale).

Breaks number_format() callers and any code reading localeconv() for separators.

Mentioned in backlog #10269; this is the actionable repro.

php-src reference

Repro

test/repro/maintainer_gap_localeconv_fields.php:

<?php
declare(strict_types=1);
$lc = localeconv();
echo 'decimal=', var_export($lc['decimal_point'] ?? null, true), "\n";
echo 'thousands=', var_export($lc['thousands_sep'] ?? null, true), "\n";
echo 'currency=', var_export($lc['currency_symbol'] ?? null, true), "\n";
./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_localeconv_fields.php
# Zend: decimal='.'  thousands=''  currency=''
# VM:   decimal=NULL thousands=NULL currency=NULL

Done when

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

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #11625, #11603, #11374)

  3. PurHur commented on Jun 25, 2026

    @PurHur
    OwnerAuthor

    Already green on master — localeconv() returns decimal='.', thousands='', currency='' via FFI lconv in VmLocale::localeconv(). No additional code change required this run.

  4. PurHur commented on Jun 25, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #11547, #11636, #11603)

  5. PurHur commented on Jul 4, 2026

    @PurHur
    OwnerAuthor

    claim: worker-lane-c — starting this run

  6. PurHur commented on Jul 4, 2026

    @PurHur
    OwnerAuthor

    Merged via #15924.

    Root cause: not localeconv() itself — stmt-level $lc['decimal_point'] ?? null inside func-call args (e.g. var_export) was wired to the hoisted ArrayDimFetch slot instead of the ?? merge slot.

    Fix: final ARG_SEND pass prefers coalesce merge slot (lib/Compiler.php).

    Verification:
    ```bash
    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
    php bin/vm.php test/repro/maintainer_gap_localeconv_fields.php
    php bin/vm.php test/compliance/cases/stdlib/localeconv_fields.phpt'
    ```
    → decimal='.', thousands='', currency='', coalesce='home'

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