php / php/doc-en

curl_multi: Unable to get error code

Open
#3,942 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Extension: curl
Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

Description

The following code:

<?php

$ch = curl_init("http://127.0.0.1:12345");

$mh = curl_multi_init();

curl_multi_add_handle($mh, $ch);

do {
    curl_multi_exec($mh, $running);
    curl_multi_select($mh);
} while ($running > 0);

var_dump(curl_errno($ch), curl_multi_errno($mh));

curl_multi_remove_handle($mh, $ch);


curl_exec($ch);

var_dump(curl_errno($ch), curl_error($ch));

Resulted in this output:

int(0)
int(0)
int(7)
string(81) "Failed to connect to 127.0.0.1 port 12345 after 0 ms: Could not connect to server"

But I expected this output instead:

int(7)
int(7) // I'm not sure.
int(7)
string(81) "Failed to connect to 127.0.0.1 port 12345 after 0 ms: Could not connect to server"

PHP Version

PHP 8.2.23

Operating System

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the PHP snippet in the issue and read the documentation for curl_multi_exec(), curl_multi_errno(), curl_errno(), and curl_error(). Confirm how errors are exposed for multi handles, then update the relevant PHP documentation so the behavior and expected output are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.