Skip to content

Regression: http_build_query() legacy 3-arg int encoding_type — LogicException, Zend BC accepts (ext/standard/http.c) #13740

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

php-src keeps backward compatibility for the pre-PHP-8 three-argument form where argument #3 is an integer encoding_type (PHP_QUERY_RFC1738 / PHP_QUERY_RFC3986), not arg_separator.

This compiler rejects the legacy call with:

LogicException: http_build_query() argument #3 ($arg_separator) must be a string in this compiler build

Zend (without declare(strict_types=1) on the call site) still returns the RFC3986 query string.

Call Zend VM today
http_build_query(['a b'=>1], '', PHP_QUERY_RFC3986) 'a+b=1' LogicException
http_build_query(['a b'=>1], '', '&', PHP_QUERY_RFC3986) 'a%20b=1' OK (4-arg form)

php-src reference

Repro (verified 2026-06-29)

php test/repro/maintainer_gap_http_build_query_legacy_encoding.php
php bin/vm.php test/repro/maintainer_gap_http_build_query_legacy_encoding.php

Repro intentionally omits declare(strict_types=1) to match typical php-src BC scripts.

Scope (PHP-in-PHP first)

Layer Path
VM ext/standard/http_build_query.php (resolveOptionalSeparatorArg / resolveOptionalEncodingArg), ext/standard/VmHttpBuildQuery.php
JIT/AOT ext/standard/HttpBuildQueryJitHelper.php, lib/JIT/Builtin/…
Tests test/compliance/cases/stdlib/http_build_query_legacy_encoding.phpt

Done when (php-src-strict)

  • Legacy 3-arg int encoding repro prints ok on VM
  • 4-arg explicit form unchanged
  • Invalid separator types still TypeError/LogicException per php-src
  • JIT/AOT agree when in scope

Verification

php test/repro/maintainer_gap_http_build_query_legacy_encoding.php
php bin/vm.php test/repro/maintainer_gap_http_build_query_legacy_encoding.php

Links

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

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #13740, #13739)

  3. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    Merged in PR #13744. VM + JIT compliance + AOT lint green for legacy 3-arg encoding repro.

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