Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ PHP 8.0 UPGRADE NOTES
checks for `false`. The curl_share_close() function no longer has an effect,
instead the CurlShareHandle instance is automatically destroyed if it is no
longer referenced.
. The deprecated parameter `$version` of curl_version() has been removed.

- Enchant:
. The enchant extension now uses libenchant-2 by default when available.
Expand Down
5 changes: 5 additions & 0 deletions docs/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@
Usually we use the same content as for point 6, but included in php template
instead of the release xml.

Optionally use `phpweb/bin/createReleaseEntry -v x.y.z -r` to create
a standard announcement template for this and step 6.

Edit the generated files to expand on the base message if needed.

4. Update `php-qa/include/release-qa.php` and add the next version as an
QARELEASE (prepare for next RC). Keep `active => true` until there will be
no more QA releases. Setting the release number to 0 is sufficient to
Expand Down
8 changes: 4 additions & 4 deletions ext/curl/curl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ function curl_multi_setopt(CurlMultiHandle $multi_handle, int $option, mixed $va

function curl_exec(CurlHandle $handle): string|bool {}

function curl_file_create(string $filename, string $mimetype = UNKNOWN, string $postname = UNKNOWN): CURLFile {}
function curl_file_create(string $filename, ?string $mimetype = null, ?string $postname = null): CURLFile {}

function curl_getinfo(CurlHandle $handle, int $option = UNKNOWN): mixed {}
function curl_getinfo(CurlHandle $handle, ?int $option = null): mixed {}

function curl_init(string $url = UNKNOWN): CurlHandle|false {}
function curl_init(?string $url = null): CurlHandle|false {}

function curl_multi_add_handle(CurlMultiHandle $multi_handle, CurlHandle $handle): int {}

Expand Down Expand Up @@ -83,4 +83,4 @@ function curl_share_strerror(int $error_number): ?string {}

function curl_strerror(int $error_number): ?string {}

function curl_version(int $age = UNKNOWN): array|false {}
function curl_version(): array|false {}
9 changes: 4 additions & 5 deletions ext/curl/curl_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_curl_file_create, 0, 1, CURLFile, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, mimetype, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mimetype, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, postname, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_getinfo, 0, 1, IS_MIXED, 0)
ZEND_ARG_OBJ_INFO(0, handle, CurlHandle, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, option, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_curl_init, 0, 0, CurlHandle, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, url, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, url, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_add_handle, 0, 2, IS_LONG, 0)
Expand Down Expand Up @@ -137,7 +137,6 @@ ZEND_END_ARG_INFO()
#define arginfo_curl_strerror arginfo_curl_multi_strerror

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_version, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, age, IS_LONG, 0)
ZEND_END_ARG_INFO()


Expand Down
4 changes: 2 additions & 2 deletions ext/curl/curl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ static void curlfile_ctor(INTERNAL_FUNCTION_PARAMETERS)
ZEND_PARSE_PARAMETERS_START(1,3)
Z_PARAM_PATH_STR(fname)
Z_PARAM_OPTIONAL
Z_PARAM_STR(mime)
Z_PARAM_STR(postname)
Z_PARAM_STR_OR_NULL(mime)
Z_PARAM_STR_OR_NULL(postname)
ZEND_PARSE_PARAMETERS_END();

zend_update_property_string(curl_CURLFile_class, cf, "name", sizeof("name")-1, ZSTR_VAL(fname));
Expand Down
6 changes: 1 addition & 5 deletions ext/curl/curl_file.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

class CURLFile
{
public function __construct(
string $filename,
string $mimetype = UNKNOWN,
string $postname = UNKNOWN
) {}
public function __construct(string $filename, ?string $mimetype = null, ?string $postname = null) {}

/** @return string */
public function getFilename() {}
Expand Down
4 changes: 2 additions & 2 deletions ext/curl/curl_file_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile___construct, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, mimetype, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mimetype, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, postname, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile_getFilename, 0, 0, 0)
Expand Down
23 changes: 7 additions & 16 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1689,23 +1689,13 @@ static void curl_free_slist(zval *el)
}
/* }}} */

/* {{{ proto array curl_version([int version])
/* {{{ proto array curl_version()
Return cURL version information. */
PHP_FUNCTION(curl_version)
{
curl_version_info_data *d;
zend_long uversion = -1;

ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(uversion)
ZEND_PARSE_PARAMETERS_END();

if (uversion == CURLVERSION_NOW) {
php_error_docref(NULL, E_DEPRECATED, "The $version parameter is deprecated");
} else if (ZEND_NUM_ARGS() > 0) {
php_error_docref(NULL, E_WARNING, "$version argument ignored");
}
ZEND_PARSE_PARAMETERS_NONE();

d = curl_version_info(CURLVERSION_NOW);
if (d == NULL) {
Expand Down Expand Up @@ -1871,7 +1861,7 @@ PHP_FUNCTION(curl_init)

ZEND_PARSE_PARAMETERS_START(0,1)
Z_PARAM_OPTIONAL
Z_PARAM_STR(url)
Z_PARAM_STR_OR_NULL(url)
ZEND_PARSE_PARAMETERS_END();

cp = curl_easy_init();
Expand Down Expand Up @@ -3018,17 +3008,18 @@ PHP_FUNCTION(curl_getinfo)
{
zval *zid;
php_curl *ch;
zend_long option = 0;
zend_long option;
zend_bool option_is_null = 1;

ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_OBJECT_OF_CLASS(zid, curl_ce)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(option)
Z_PARAM_LONG_OR_NULL(option, option_is_null)
ZEND_PARSE_PARAMETERS_END();

ch = Z_CURL_P(zid);

if (ZEND_NUM_ARGS() < 2) {
if (option_is_null) {
char *s_code;
/* libcurl expects long datatype. So far no cases are known where
it would be an issue. Using zend_long would truncate a 64-bit
Expand Down
15 changes: 0 additions & 15 deletions ext/curl/tests/curl_version_error_001.phpt

This file was deleted.

24 changes: 19 additions & 5 deletions ext/openssl/tests/CertificateGenerator.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class CertificateGenerator
{
const CONFIG = __DIR__. DIRECTORY_SEPARATOR . 'openssl.cnf';
const SAN_CONFIG = __DIR__ . DIRECTORY_SEPARATOR . 'san.cnf';

/** @var resource */
private $ca;
Expand Down Expand Up @@ -82,23 +83,36 @@ class CertificateGenerator
openssl_x509_export_to_file($this->ca, $file);
}

public function saveNewCertAsFileWithKey($commonNameForCert, $file, $keyLength = null)
{
public function saveNewCertAsFileWithKey(
$commonNameForCert, $file, $keyLength = null, $subjectAltName = null
) {
$dn = [
'countryName' => 'BY',
'stateOrProvinceName' => 'Minsk',
'localityName' => 'Minsk',
'organizationName' => 'Example Org',
'commonName' => $commonNameForCert,
];
if ($commonNameForCert !== null) {
$dn['commonName'] = $commonNameForCert;
}

$config = [
'digest_alg' => 'sha256',
'req_extensions' => 'v3_req',
'x509_extensions' => 'usr_cert',
];
if ($subjectAltName !== null) {
putenv("PHP_SUBJECTALTNAME=$subjectAltName");
$config['config'] = self::SAN_CONFIG;
}

$this->lastKey = self::generateKey($keyLength);
$this->lastCert = openssl_csr_sign(
openssl_csr_new($dn, $this->lastKey, ['req_extensions' => 'v3_req']),
openssl_csr_new($dn, $this->lastKey, $config),
$this->ca,
$this->caKey,
/* days */ 2,
['digest_alg' => 'sha256'],
$config,
);

$certText = '';
Expand Down
32 changes: 0 additions & 32 deletions ext/openssl/tests/bug65729.pem

This file was deleted.

21 changes: 18 additions & 3 deletions ext/openssl/tests/bug65729.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug65729.pem.tmp';
$cacertFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug65729-ca.pem.tmp';

$serverCode = <<<'CODE'
$serverUri = "ssl://127.0.0.1:64321";
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => __DIR__ . '/bug65729.pem'
'local_cert' => '%s'
]]);

$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
Expand All @@ -22,6 +25,7 @@ $serverCode = <<<'CODE'
@stream_socket_accept($server, 1);
}
CODE;
$serverCode = sprintf($serverCode, $certFile);

$clientCode = <<<'CODE'
$serverUri = "ssl://127.0.0.1:64321";
Expand All @@ -32,18 +36,29 @@ $clientCode = <<<'CODE'
$expected_names = ['foo.test.com.sg', 'foo.test.com', 'FOO.TEST.COM', 'foo.bar.test.com'];
foreach ($expected_names as $expected_name) {
$clientCtx = stream_context_create(['ssl' => [
'verify_peer' => true,
'allow_self_signed' => true,
'verify_peer' => true,
'peer_name' => $expected_name,
'cafile' => '%s',
]]);

var_dump(stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx));
}
CODE;
$clientCode = sprintf($clientCode, $cacertFile);

include 'CertificateGenerator.inc';
$certificateGenerator = new CertificateGenerator();
$certificateGenerator->saveCaCert($cacertFile);
$certificateGenerator->saveNewCertAsFileWithKey('*.test.com', $certFile);

include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug65729.pem.tmp');
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug65729-ca.pem.tmp');
?>
--EXPECTF--
Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not match expected CN=`foo.test.com.sg' in %s on line %d

Expand Down
33 changes: 0 additions & 33 deletions ext/openssl/tests/bug68265.pem

This file was deleted.

15 changes: 13 additions & 2 deletions ext/openssl/tests/bug68265.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'bug68265.pem.tmp';
$san = 'DNS:debs.ak-online.be., DNS:debs.ak-online.net.';

$serverCode = <<<'CODE'
$serverUri = "ssl://127.0.0.1:64321";
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => __DIR__ . '/bug68265.pem',
'passphrase' => 'elephpant',
'local_cert' => '%s',
]]);

$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
phpt_notify();

stream_socket_accept($server, 30);
CODE;
$serverCode = sprintf($serverCode, $certFile);

$clientCode = <<<'CODE'
$serverUri = "ssl://127.0.0.1:64321";
Expand All @@ -35,8 +38,16 @@ $clientCode = <<<'CODE'
var_dump(stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx));
CODE;

include 'CertificateGenerator.inc';
$certificateGenerator = new CertificateGenerator();
$certificateGenerator->saveNewCertAsFileWithKey('test.com', $certFile, null, $san);

include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug68265.pem.tmp');
?>
--EXPECTF--
resource(%d) of type (stream)
Loading