curl_setopt(_array) should warn on errors
未关闭
还没有人认领这个 Issue。
Extension: curl
Feature
Status: Needs Triage
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
When using curl_setopt_array to set CURLOPT_RETURNTRANSFER it returns the result and bool.
I was able to fix this by adding curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
<?php
$ch = curl_init();
$options = [CURLOPT_URL => 'https://google.com', CURLOPT_TCP_FASTOPEN => true, CURLOPT_TRANSFERTEXT => false, CURLOPT_RETURNTRANSFER => true];
curl_setopt_array($ch, $options);
$res = curl_exec($ch);
curl_close($ch);
var_dump($res);
Resulted in this output:
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
bool(true)
But I expected this output instead:
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
PHP Version
8.1.6 & 8.1.12
Operating System
Windows 10
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在 PHP 8.1 上复现所提供的 curl_setopt_array 示例,并将其返回值与报告的输出进行比较。然后跟踪 php-src 中的 curl_setopt_array 入口点;确定报告的错误条件,并通过回归测试覆盖预期的警告行为后,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100