Skip to content

Regression: curl_escape()/curl_unescape() still 1-arg — php-src requires CurlHandle (re-#13588, ext/curl/interface.c) #20493

Description

@PurHur

Category

stdlib · php-src-strict · ext/curl · signature parity (re-#13588)

Problem

#13588 gated curl_escape/curl_unescape on extension_loaded('curl'), but the arity/signature fix never landed. php-src requires curl_escape(CurlHandle $handle, string $string); this compiler still registers a 1-arg string-only API.

Verified 2026-07-18 on master (b6b30adbf) with curl advertised (extension_loaded('curl') true).

Repro Zend / php-src VM (2026-07-18)
curl_escape($ch, 'a b') 'a%20b' ArgumentCountError (expects exactly 1 argument)
curl_escape('a b') TypeError (CurlHandle required) 'a%20b' (accepts phantom 1-arg)
same for curl_unescape 2-arg same 1-arg drift

php-src reference

PHP implementation target

  • ext/curl/curl_escape.php, ext/curl/curl_unescape.php — require CurlHandle (or curl resource) as arg0; coerce string as arg1; keep encode/decode in VmCurlEscape (PHP-in-PHP)
  • JIT paths in the same files — drop 1-arg JitUrlencode shortcut arity
  • No new runtime/*.c logic

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r '\''$ch=curl_init(); try { var_export(curl_escape($ch, "a b")); } catch (Throwable $e) { echo get_class($e), ":", $e->getMessage(); }'\'''

Done when

  • curl_escape($ch, 'a b') / curl_unescape($ch, 'a%20b') match Zend when curl is loaded
  • bare curl_escape('a b') TypeErrors like php-src (CurlHandle required)
  • Compliance .phpt under test/compliance/cases/curl/ (or repro + unit)
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    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 Jul 18, 2026
  2. PurHur commented on Jul 18, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler Ext — I/O & Crypto — starting this run

    Trust probe (this workspace):

    • docker info OK; vendor present
    • php script/bootstrap-inventory.php --check → OK 5646/5646
    • ./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-link' → OK /compiler/build/selfhost
    • ./script/release-readiness.sh --json — still running; will note if red

    Implementing curl_escape/curl_unescape 2-arg CurlHandle signature (php-src-strict, re-#13588).

  3. PurHur commented on Jul 18, 2026

    @PurHur
    OwnerAuthor

    merged: #20514

    Verification

    • php bin/vm.php test/repro/issue_20493_curl_escape_handle.php → ok 'a%20b' / ok 'a b' / 1arg ArgumentCountError / badhandle TypeError:…CurlHandle
    • VM compliance --filter curl_escape → OK (4)
    • JIT compliance --filter curl_escape → OK (3)
    • unit CurlEscape/CurlModule/CurlExtensionPolicy → OK
    • php-src-strict: curl_escape(CurlHandle, string) / curl_unescape(CurlHandle, string)
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 machinebugSomething isn't workingimplementation-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