Skip to content

Commit 226c2ff

Browse files
committed
openssl test fixes
1 parent a9f1a60 commit 226c2ff

17 files changed

+34
-161
lines changed

ext/gettext/tests/dcngettext.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ if (!function_exists("dcngettext")) die("skip dcngettext() doesn't exist");
88
--FILE--
99
<?php
1010

11-
var_dump(dcngettext(1,1,1,1));
1211
var_dump(dcngettext(1,1,1,1,1));
1312
var_dump(dcngettext("test","test","test",1,1));
1413
var_dump(dcngettext("test","test","test",0,0));
@@ -18,9 +17,7 @@ var_dump(dcngettext("","","",0,0));
1817

1918
echo "Done\n";
2019
?>
21-
--EXPECTF--
22-
Warning: dcngettext() expects exactly 5 parameters, 4 given in %s on line %d
23-
bool(false)
20+
--EXPECT--
2421
string(1) "1"
2522
string(4) "test"
2623
string(4) "test"

ext/openssl/tests/bug38255.phpt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ $t = new test;
2020

2121
var_dump(openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
2222
var_dump(openssl_verify("foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
23-
var_dump(openssl_verify("foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5));
24-
var_dump(openssl_verify("foo", new stdClass, array(), OPENSSL_ALGO_MD5));
25-
var_dump(openssl_verify("foo", array(), array(), OPENSSL_ALGO_MD5));
26-
var_dump(openssl_verify());
27-
var_dump(openssl_verify(new stdClass, new stdClass, array(), 10000));
2823

2924
echo "Done\n";
3025

@@ -37,19 +32,4 @@ bool(false)
3732

3833
Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
3934
bool(false)
40-
41-
Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d
42-
NULL
43-
44-
Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d
45-
NULL
46-
47-
Warning: openssl_verify() expects parameter 2 to be string, array given in %s on line %d
48-
NULL
49-
50-
Warning: openssl_verify() expects at least 3 parameters, 0 given in %s on line %d
51-
NULL
52-
53-
Warning: openssl_verify() expects parameter 1 to be string, object given in %s on line %d
54-
NULL
5535
Done

ext/openssl/tests/bug38261.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ $t = new test;
1717
var_dump(openssl_x509_parse("foo"));
1818
var_dump(openssl_x509_parse($t));
1919
var_dump(openssl_x509_parse(array()));
20-
var_dump(openssl_x509_parse());
2120
var_dump(openssl_x509_parse($cert));
2221
var_dump(openssl_x509_parse(new stdClass));
2322

@@ -26,9 +25,6 @@ var_dump(openssl_x509_parse(new stdClass));
2625
bool(false)
2726
bool(false)
2827
bool(false)
29-
30-
Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %sbug38261.php on line %d
31-
NULL
3228
bool(false)
3329

3430
Recoverable fatal error: Object of class stdClass could not be converted to string in %sbug38261.php on line %d

ext/openssl/tests/openssl_csr_export_bacis.phpt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,20 @@ $args = array(
2727
$privkey = openssl_pkey_new($config_arg);
2828
$csr = openssl_csr_new($dn, $privkey, $args);
2929
var_dump(openssl_csr_export($csr, $output));
30-
var_dump(openssl_csr_export($wrong, $output));
30+
try {
31+
var_dump(openssl_csr_export($wrong, $output));
32+
} catch (TypeError $e) {
33+
echo $e->getMessage(), "\n";
34+
}
3135
var_dump(openssl_csr_export($privkey, $output));
32-
var_dump(openssl_csr_export(array(), $output));
3336
var_dump(openssl_csr_export($csr, $output, false));
3437
?>
3538
--EXPECTF--
3639
bool(true)
37-
38-
Warning: openssl_csr_export() expects parameter 1 to be resource, string given in %s on line %d
39-
NULL
40+
openssl_csr_export() expects parameter 1 to be resource, string given
4041

4142
Warning: openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d
4243

4344
Warning: openssl_csr_export(): cannot get CSR from parameter 1 in %s on line %d
4445
bool(false)
45-
46-
Warning: openssl_csr_export() expects parameter 1 to be resource, array given in %s on line %d
47-
NULL
4846
bool(true)

ext/openssl/tests/openssl_csr_export_to_file_basic.phpt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ $privkey_file = 'file://' . dirname(__FILE__) . '/private_rsa_2048.key';
3636
$csr = openssl_csr_new($dn, $privkey_file, $args);
3737
var_dump(openssl_csr_export_to_file($csr, $csrfile));
3838
var_dump(file_get_contents($csrfile));
39-
var_dump(openssl_csr_export_to_file($wrong, $csrfile));
39+
try {
40+
var_dump(openssl_csr_export_to_file($wrong, $csrfile));
41+
} catch (TypeError $e) {
42+
echo $e->getMessage(), "\n";
43+
}
4044
var_dump(openssl_csr_export_to_file($dh, $csrfile));
41-
var_dump(openssl_csr_export_to_file(array(), $csrfile));
4245
var_dump(openssl_csr_export_to_file($csr, $csrfile, false));
4346
?>
4447
--CLEAN--
@@ -69,15 +72,10 @@ sfBgVeqg0P4SWez5fHXqBNcjMdMI5f0bikcDZSIfTHS8FX+PMurLBC8UPB0YNIOl
6972
JViHkCA9x6m8RJXAFvqmgLlWlUzbDv/cRrDfjWjR
7073
-----END CERTIFICATE REQUEST-----
7174
"
72-
73-
Warning: openssl_csr_export_to_file() expects parameter 1 to be resource, string given in %s on line %d
74-
NULL
75+
openssl_csr_export_to_file() expects parameter 1 to be resource, string given
7576

7677
Warning: openssl_csr_export_to_file(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d
7778

7879
Warning: openssl_csr_export_to_file(): cannot get CSR from parameter 1 in %s on line %d
7980
bool(false)
80-
81-
Warning: openssl_csr_export_to_file() expects parameter 1 to be resource, array given in %s on line %d
82-
NULL
8381
bool(true)

ext/openssl/tests/openssl_csr_new_basic.phpt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ openssl_csr_new() tests
55
--FILE--
66
<?php
77

8-
$a = 1;
9-
var_dump(openssl_csr_new(1,$a));
10-
var_dump(openssl_csr_new(1,$a,1,1));
118
$a = array();
129

1310
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
@@ -26,12 +23,6 @@ var_dump(openssl_csr_new(["countryName" => "DE"], $x, $conf + ["x509_extensions"
2623
echo "Done\n";
2724
?>
2825
--EXPECTF--
29-
Warning: openssl_csr_new() expects parameter 1 to be array, int given in %s on line %d
30-
NULL
31-
32-
Warning: openssl_csr_new() expects parameter 1 to be array, int given in %s on line %d
33-
NULL
34-
3526
Warning: openssl_csr_new(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
3627

3728
Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in %s on line %d

ext/openssl/tests/openssl_csr_sign_basic.phpt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ var_dump(openssl_csr_sign($csr, $cert, $priv, 365, $config_arg));
3535
var_dump(openssl_csr_sign($csr, openssl_x509_read($cert), $priv, 365, $config_arg));
3636
var_dump(openssl_csr_sign($csr, $wrong, $privkey, 365));
3737
var_dump(openssl_csr_sign($csr, null, $wrong, 365));
38-
var_dump(openssl_csr_sign($csr, null, $privkey, $wrong));
39-
var_dump(openssl_csr_sign($csr, null, $privkey, 365, $wrong));
4038
var_dump(openssl_csr_sign($wrong, null, $privkey, 365));
4139
var_dump(openssl_csr_sign(array(), null, $privkey, 365));
4240
var_dump(openssl_csr_sign($csr, array(), $privkey, 365));
4341
var_dump(openssl_csr_sign($csr, null, array(), 365));
44-
var_dump(openssl_csr_sign($csr, null, $privkey, array()));
4542
var_dump(openssl_csr_sign($csr, null, $privkey, 365, $config_arg));
4643
?>
4744
--EXPECTF--
@@ -56,12 +53,6 @@ bool(false)
5653
Warning: openssl_csr_sign(): cannot get private key from parameter 3 in %s on line %d
5754
bool(false)
5855

59-
Warning: openssl_csr_sign() expects parameter 4 to be int, string given in %s on line %d
60-
NULL
61-
62-
Warning: openssl_csr_sign() expects parameter 5 to be array, string given in %s on line %d
63-
NULL
64-
6556
Warning: openssl_csr_sign(): cannot get CSR from parameter 1 in %s on line %d
6657
bool(false)
6758

@@ -75,7 +66,4 @@ Warning: openssl_csr_sign(): key array must be of the form array(0 => key, 1 =>
7566

7667
Warning: openssl_csr_sign(): cannot get private key from parameter 3 in %s on line %d
7768
bool(false)
78-
79-
Warning: openssl_csr_sign() expects parameter 4 to be int, array given in %s on line %d
80-
NULL
8169
resource(%d) of type (OpenSSL X.509)

ext/openssl/tests/openssl_decrypt_error.phpt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ var_dump(openssl_decrypt($wrong, $method, $password));
1919
var_dump(openssl_decrypt($wrong, $wrong, $password));
2020
var_dump(openssl_decrypt($encrypted, $wrong, $wrong));
2121
var_dump(openssl_decrypt($wrong, $wrong, $wrong));
22-
var_dump(openssl_decrypt(array(), $method, $password));
23-
var_dump(openssl_decrypt($encrypted, array(), $password));
24-
var_dump(openssl_decrypt($encrypted, $method, array()));
2522

2623
// invalid using of an authentication tag
2724
var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong));
@@ -45,14 +42,5 @@ bool(false)
4542
Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d
4643
bool(false)
4744

48-
Warning: openssl_decrypt() expects parameter 1 to be string, array given in %s on line %d
49-
NULL
50-
51-
Warning: openssl_decrypt() expects parameter 2 to be string, array given in %s on line %d
52-
NULL
53-
54-
Warning: openssl_decrypt() expects parameter 3 to be string, array given in %s on line %d
55-
NULL
56-
5745
Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d
5846
string(44) "yof6cPPH4mLee6TOc0YQSrh4dvywMqxGUyjp0lV6+aM="

ext/openssl/tests/openssl_encrypt_error.phpt

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ $arr = array(1);
1414

1515
// wrong parameters tests
1616
var_dump(openssl_encrypt($data, $wrong, $password));
17-
var_dump(openssl_encrypt($object, $method, $password));
18-
var_dump(openssl_encrypt($data, $object, $password));
19-
var_dump(openssl_encrypt($data, $method, $object));
20-
var_dump(openssl_encrypt($arr, $method, $object));
21-
var_dump(openssl_encrypt($data, $arr, $object));
22-
var_dump(openssl_encrypt($data, $method, $arr));
2317

2418
// invalid using of an authentication tag
2519
var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong));
@@ -31,24 +25,6 @@ var_dump(openssl_encrypt($data, $method, $password, OPENSSL_DONT_ZERO_PAD_KEY, $
3125
Warning: openssl_encrypt(): Unknown cipher algorithm in %s on line %d
3226
bool(false)
3327

34-
Warning: openssl_encrypt() expects parameter 1 to be string, object given in %s on line %d
35-
NULL
36-
37-
Warning: openssl_encrypt() expects parameter 2 to be string, object given in %s on line %d
38-
NULL
39-
40-
Warning: openssl_encrypt() expects parameter 3 to be string, object given in %s on line %d
41-
NULL
42-
43-
Warning: openssl_encrypt() expects parameter 1 to be string, array given in %s on line %d
44-
NULL
45-
46-
Warning: openssl_encrypt() expects parameter 2 to be string, array given in %s on line %d
47-
NULL
48-
49-
Warning: openssl_encrypt() expects parameter 3 to be string, array given in %s on line %d
50-
NULL
51-
5228
Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d
5329
string(44) "iPR4HulskuaP5Z6me5uImk6BqVyJG73+63tkPauVZYk="
5430

ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ var_dump(openssl_pkcs7_encrypt($infile, $outfile, openssl_x509_read($single_cert
2626
var_dump(openssl_pkcs7_decrypt($outfile, $outfile2, $single_cert, $privkey));
2727
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $assoc_headers));
2828
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $empty_headers));
29-
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $wrong));
3029
var_dump(openssl_pkcs7_encrypt($wrong, $outfile, $single_cert, $headers));
3130
var_dump(openssl_pkcs7_encrypt($empty, $outfile, $single_cert, $headers));
3231
var_dump(openssl_pkcs7_encrypt($infile, $empty, $single_cert, $headers));
3332
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $wrong, $headers));
3433
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $empty, $headers));
35-
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $empty));
3634
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $multi_certs, $headers));
3735
var_dump(openssl_pkcs7_encrypt($infile, $outfile, array_map('openssl_x509_read', $multi_certs) , $headers));
3836

@@ -45,23 +43,17 @@ if (file_exists($outfile2)) {
4543
unlink($outfile2);
4644
}
4745
?>
48-
--EXPECTF--
46+
--EXPECT--
4947
bool(true)
5048
bool(true)
5149
bool(true)
5250
bool(true)
5351
bool(true)
54-
55-
Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, string given in %s on line %d
56-
bool(false)
5752
bool(false)
5853
bool(false)
5954
bool(false)
6055
bool(false)
6156
bool(false)
62-
63-
Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, string given in %s on line %d
64-
bool(false)
6557
bool(true)
6658
bool(true)
6759
true

0 commit comments

Comments
 (0)