Skip to content

Stdlib: curl_escape()/curl_unescape() — 1-arg phantom API without ext/curl; php-src requires CurlHandle (ext/curl/interface.c) #13588

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Two parity failures vs php-src ext/curl/interface.c:

  1. function_exists('curl_escape') is true while extension_loaded('curl') is false — phantom partial curl surface (same class as grapheme_* without intl, Stdlib: grapheme_extract()/grapheme_substr()/grapheme_strpos() without ext/intl — function_exists true, Zend false (ext/intl/grapheme) #11803).
  2. Wrong arity/signature: php-src curl_escape(CurlHandle $ch, string $str) (2 args); this compiler registers 1-arg curl_escape(string $str) in ext/curl/curl_escape.php.

When libcurl is available on the host, Zend requires a handle; VM accepts a bare string.

php-src reference

Repro (verified 2026-06-29)

test/repro/maintainer_gap_curl_escape_phantom_signature.php:

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_curl_escape_phantom_signature.php; echo ---; php bin/vm.php test/repro/maintainer_gap_curl_escape_phantom_signature.php'
Check Zend (no ext/curl on reference profile) VM
extension_loaded('curl') false false
function_exists('curl_escape') false true ❌
curl_escape($ch, 'a b') when curl loaded a%20b N/A (no curl_init)
curl_escape('a b') one-arg ArgumentCountError a%20b ❌

Scope (PHP-in-PHP first)

Layer Path
Policy ext/curl/CurlExtensionPolicy.php — gate escape helpers on extension_loaded('curl') like handle classes
Builtin ext/curl/curl_escape.php, curl_unescape.php — adopt 2-arg php-src signature when #3325 lands
Registry ext/curl/Module.php, ext/standard/Module.php — stop advertising curl helpers without extension
Tests test/compliance/cases/stdlib/curl_escape_phantom.phpt

No new C runtime.

Done when (php-src-strict)

Related

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 30, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #13588)

  3. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Merged via #14025.

    Verification: php bin/vm.php test/repro/maintainer_gap_curl_escape_phantom_signature.php → ok; function_exists('curl_escape') → false when extension_loaded('curl') is false; unit tests CurlModuleTest / CurlEscapeBuiltinTest green; php bin/compile.php -l on repro exits 0.

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