Skip to content

Stdlib: ext/curl — curl_init/exec/getinfo and HTTP client API (ext/curl parity) #3325

Description

@PurHur

Category

stdlib

Problem

HTTP client code and Composer HTTP discovery depend on ext/curl (curl_init, curl_setopt, curl_exec, …). This compiler has no curl builtins (function_exists('curl_init') → false), blocking parity with typical PHP deployments.

php-src reference

  • ext/curl/interface.c — PHP_FUNCTION(curl_init), curl_setopt, curl_exec, curl_getinfo, curl_error, curl_close
  • ext/curl/multi.c — curl_multi_* (phase 2)
  • ext/curl/curl_file.c — CURLFile for multipart (phase 2)

Repro (today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "var_export(function_exists(\"curl_init\"));"'

Zend (curl ext): true · This compiler: false

v1 behavior target

<?php
$ch = curl_init('https://example.com/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo is_string($body) ? $code : 'fail';

Zend: HTTP status int (e.g. 200 or 404 depending on network). Document harness may use file:// or mock if CI must be offline.

Scope (this repo)

  • ext/curl/Module.php + VM handlers wrapping libcurl (or thin FFI to system libcurl in Docker image)
  • Register resource type for curl handles in VM
  • Constants: CURLOPT_*, CURLINFO_* minimal subset for GET/POST
  • test/compliance/cases/stdlib/curl_init.phpt with @group network or local test server

Done when

  • curl_init / curl_setopt / curl_exec / curl_getinfo / curl_error / curl_close work on VM
  • Repro returns numeric HTTP code on harness with network (or documented skip)
  • docs/capabilities.md lists curl functions

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter CurlInit'

Links

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:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions