8000 ext/curl: Refactor cURL to only use FCC by Girgias · Pull Request #13291 · php/php-src · GitHub
[go: up one dir, main page]

Skip to content

ext/curl: Refactor cURL to only use FCC #13291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test due to unavailable SSH_HOSTKEY option
  • Loading branch information
Girgias committed Apr 30, 2024
commit b9731c84774e52d0b4150d456fbee026f3389bb0
36 changes: 36 additions & 0 deletions ext/curl/tests/curl_setopt_SSH_HOSTKEY_callable.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--TEST--
Test curl_setopt(_array)() with CURLOPT_SSH_HOSTKEYFUNCTION option
--EXTENSIONS--
curl
--SKIPIF--
<?php
$curl_version = curl_version();
if ($curl_version['version_number'] < 0x075400) {
die("skip: blob options not supported for curl < 7.84.0");
}
?>
--FILE--
<?php

function testOption(CurlHandle $handle, int $option) {
try {
var_dump(curl_setopt($handle, $option, 'undefined'));
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

try {
var_dump(curl_setopt_array($handle, [$option => 'undefined']));
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
}

$url = "https://example.com";
$ch = curl_init($url);
testOption($ch, CURLOPT_SSH_HOSTKEYFUNCTION);

?>
--EXPECT--
TypeError: curl_setopt(): Argument #3 ($value) must be a valid callback for option CURLOPT_SSH_HOSTKEYFUNCTION, function "undefined" not found or invalid function name
TypeError: curl_setopt_array(): Argument #2 ($options) must be a valid callback for option CURLOPT_SSH_HOSTKEYFUNCTION, function "undefined" not found or invalid function name
7 changes: 1 addition & 6 deletions ext/curl/tests/curl_setopt_callables.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Test curl_setopt(_array)() with options that take callabes
curl
--FILE--
<?php
include 'server.inc';
$host = curl_cli_server_start();

function testOption(CurlHandle $handle, int $option) {
try {
Expand All @@ -21,10 +19,9 @@ function testOption(CurlHandle $handle, int $option) {
}
}

$url = "{$host}/get.inc";
$url = "https://example.com";
$ch = curl_init($url);
testOption($ch, CURLOPT_PROGRESSFUNCTION);
testOption($ch, CURLOPT_SSH_HOSTKEYFUNCTION);
testOption($ch, CURLOPT_XFERINFOFUNCTION);
testOption($ch, CURLOPT_FNMATCH_FUNCTION);
testOption($ch, CURLOPT_WRITEFUNCTION);
Expand All @@ -35,8 +32,6 @@ testOption($ch, CURLOPT_READFUNCTION);
--EXPECT--
TypeError: curl_setopt(): Argument #3 ($value) must be a valid callback for option CURLOPT_PROGRESSFUNCTION, function "undefined" not found or invalid function name
TypeError: curl_setopt_array(): Argument #2 ($options) must be a valid callback for option CURLOPT_PROGRESSFUNCTION, function "undefined" not found or invalid function name
TypeError: curl_setopt(): Argument #3 ($value) must be a valid callback for option CURLOPT_SSH_HOSTKEYFUNCTION, function "undefined" not found or invalid function name
TypeError: curl_setopt_array(): Argument #2 ($options) must be a valid callback for option CURLOPT_SSH_HOSTKEYFUNCTION, function "undefined" not found or invalid function name
TypeError: curl_setopt(): Argument #3 ($value) must be a valid callback for option CURLOPT_XFERINFOFUNCTION, function "undefined" not found or invalid function name
TypeError: curl_setopt_array(): Argument #2 ($options) must be a valid callback for option CURLOPT_XFERINFOFUNCTION, function "undefined" not found or invalid function name
TypeError: curl_setopt(): Argument #3 ($value) must be a valid callback for option CURLOPT_FNMATCH_FUNCTION, function "undefined" not found or invalid function name
Expand Down
0