Skip to content

Commit 77bd405

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
2 parents e62c6e7 + b20bcbc commit 77bd405

File tree

88 files changed

+780
-708
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+780
-708
lines changed

ext/openssl/tests/001.phpt

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,43 @@ if (!@openssl_pkey_new()) die("skip cannot create private key");
99
<?php
1010
echo "Creating private key\n";
1111

12-
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
12+
$conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf');
1313
$privkey = openssl_pkey_new($conf);
1414

15-
if ($privkey === false)
16-
die("failed to create private key");
15+
if ($privkey === false) {
16+
die("failed to create private key");
17+
}
1718

1819
$passphrase = "banana";
19-
$key_file_name = tempnam(sys_get_temp_dir(), "ssl");
20-
if ($key_file_name === false)
21-
die("failed to get a temporary filename!");
20+
$key_file_name = __DIR__ . '/001-tmp.key';
21+
if ($key_file_name === false) {
22+
die("failed to get a temporary filename!");
23+
}
2224

2325
echo "Export key to file\n";
2426

25-
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
27+
if (!openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf)) {
28+
die("failed to export to file $key_file_name");
29+
}
2630
var_dump(is_resource($privkey));
2731

2832
echo "Load key from file - array syntax\n";
2933

3034
$loaded_key = openssl_pkey_get_private(array("file://$key_file_name", $passphrase));
3135

32-
if ($loaded_key === false)
33-
die("failed to load key using array syntax");
36+
if ($loaded_key === false) {
37+
die("failed to load key using array syntax");
38+
}
3439

3540
openssl_pkey_free($loaded_key);
3641

3742
echo "Load key using direct syntax\n";
3843

3944
$loaded_key = openssl_pkey_get_private("file://$key_file_name", $passphrase);
4045

41-
if ($loaded_key === false)
42-
die("failed to load key using direct syntax");
46+
if ($loaded_key === false) {
47+
die("failed to load key using direct syntax");
48+
}
4349

4450
openssl_pkey_free($loaded_key);
4551

@@ -48,15 +54,13 @@ echo "Load key manually and use string syntax\n";
4854
$key_content = file_get_contents($key_file_name);
4955
$loaded_key = openssl_pkey_get_private($key_content, $passphrase);
5056

51-
if ($loaded_key === false)
52-
die("failed to load key using string syntax");
53-
57+
if ($loaded_key === false) {
58+
die("failed to load key using string syntax");
59+
}
5460
openssl_pkey_free($loaded_key);
5561

5662
echo "OK!\n";
5763

58-
@unlink($key_file_name);
59-
6064
?>
6165
--EXPECT--
6266
Creating private key
@@ -66,3 +70,8 @@ Load key from file - array syntax
6670
Load key using direct syntax
6771
Load key manually and use string syntax
6872
OK!
73+
--CLEAN--
74+
<?php
75+
$key_file_name = __DIR__ . DIRECTORY_SEPARATOR . '001-tmp.key';
76+
@unlink($key_file_name);
77+
?>

ext/openssl/tests/bug28382.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
Bug #28382 (openssl_x509_parse extensions support)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("openssl")) die("skip");
6-
if (OPENSSL_VERSION_NUMBER<0x009070af) die("skip");
5+
if (!extension_loaded("openssl")) die("skip");
76
?>
87
--FILE--
98
<?php

ext/openssl/tests/bug36732.phpt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@ Bug #36732 (add support for req_extensions in openss_csr_new and sign)
33
--SKIPIF--
44
<?php
55
if (!extension_loaded("openssl")) die("skip");
6-
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
76
?>
87
--FILE--
98
<?php
109
$configargs = array(
11-
"req_extensions" => "v3_req",
12-
"x509_extensions" => "usr_cert",
13-
"config" => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf",
10+
"req_extensions" => "v3_req",
11+
"x509_extensions" => "usr_cert",
12+
"config" => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf",
1413
);
1514

1615
$dn = array(
17-
"countryName" => "GB",
18-
"stateOrProvinceName" => "Berkshire",
19-
"localityName" => "Newbury",
20-
"organizationName" => "My Company Ltd",
21-
"commonName" => "Demo Cert"
16+
"countryName" => "GB",
17+
"stateOrProvinceName" => "Berkshire",
18+
"localityName" => "Newbury",
19+
"organizationName" => "My Company Ltd",
20+
"commonName" => "Demo Cert"
2221
);
2322

2423
$key = openssl_pkey_new();
@@ -29,11 +28,11 @@ $str = '';
2928
openssl_csr_export($csr, $str, false);
3029

3130
if (strpos($str, 'Requested Extensions:')) {
32-
echo "Ok\n";
31+
echo "Ok\n";
3332
}
3433
openssl_x509_export($crt, $str, false);
3534
if (strpos($str, 'X509v3 extensions:')) {
36-
echo "Ok\n";
35+
echo "Ok\n";
3736
}
3837
?>
3938
--EXPECTF--

ext/openssl/tests/bug37820.phpt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ openssl_sign/verify: accept different algos
33
--SKIPIF--
44
<?php
55
if (!extension_loaded("openssl")) die("skip");
6-
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
76
?>
87
--FILE--
98
<?php
@@ -15,19 +14,18 @@ $priv_key = file_get_contents($file_key);
1514
$priv_key_id = openssl_get_privatekey($priv_key);
1615

1716

18-
1917
$pub_key = file_get_contents($file_pub);
2018
$pub_key_id = openssl_get_publickey($pub_key);
2119
$data = "some custom data";
2220
if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) {
23-
echo "openssl_sign failed.";
21+
echo "openssl_sign failed.";
2422
}
2523

2624
$ok = openssl_verify($data, $signature, $pub_key_id, OPENSSL_ALGO_MD5);
2725
if ($ok == 1) {
28-
echo "Ok";
26+
echo "Ok";
2927
} elseif ($ok == 0) {
30-
echo "openssl_verify failed.";
28+
echo "openssl_verify failed.";
3129
}
3230

3331

ext/openssl/tests/bug38255.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ $signature = '';
1111
$ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
1212

1313
class test {
14-
function __toString() {
15-
return "test object";
16-
}
14+
function __toString() {
15+
return "test object";
16+
}
1717
}
1818
$t = new test;
1919

ext/openssl/tests/bug38261.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ if (!extension_loaded("openssl")) die("skip");
88
<?php
99
$cert = false;
1010
class test {
11-
function __toString() {
12-
return "test object";
13-
}
11+
function __toString() {
12+
return "test object";
13+
}
1414
}
1515
$t = new test;
1616

ext/openssl/tests/bug39217.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ if (!extension_loaded("openssl")) die("skip");
99
$dir = dirname(__FILE__);
1010
$certs = array('bug39217cert2.txt', 'bug39217cert1.txt');
1111
foreach($certs as $cert) {
12-
$res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
13-
print_r($res['serialNumber']);
14-
echo "\n";
12+
$res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
13+
print_r($res['serialNumber']);
14+
echo "\n";
1515
}
1616
?>
1717
--EXPECTF--

ext/openssl/tests/bug41033.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
--SKIPIF--
44
<?php
55
if (!extension_loaded("openssl")) die("skip, openssl required");
6-
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
76
?>
87
--FILE--
98
<?php

ext/openssl/tests/bug46127.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<?php
55
if (!extension_loaded("openssl")) die("skip openssl not loaded");
66
if (!function_exists("proc_open")) die("skip no proc_open");
7-
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip openssl version too low");
7+
?>
88
--FILE--
99
<?php
1010
$serverCode = <<<'CODE'
@@ -38,5 +38,6 @@ CODE;
3838

3939
include 'ServerClientTestCase.inc';
4040
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
41+
?>
4142
--EXPECT--
4243
Sending bug 46127

ext/openssl/tests/bug48182.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bug #48182: ssl handshake fails during asynchronous socket connection
44
<?php
55
if (!extension_loaded("openssl")) die("skip openssl not loaded");
66
if (!function_exists("proc_open")) die("skip no proc_open");
7-
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip openssl version too low");
7+
?>
88
--FILE--
99
<?php
1010
$serverCode = <<<'CODE'
@@ -44,6 +44,7 @@ echo "Running bug48182\n";
4444

4545
include 'ServerClientTestCase.inc';
4646
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
47+
?>
4748
--EXPECTF--
4849
Running bug48182
4950
Sending bug48182

0 commit comments

Comments
 (0)