[php-src] master: ext/openssl: applied fixers to improve test robustness (#23134)
| From: | NickSdot via GitHub | Date: | Sun, 06 Sep 2026 13:04:09 +0000 |
| Subject: | [php-src] master: ext/openssl: applied fixers to improve test robustness (#23134) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141091@lists.php.net to get a copy of this message | ||
Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-09-06T14:04:06+01:00
Commit: https://github.com/php/php-src/commit/9a89de1a274ce228c1795d1cebe292bb2a2e5194
Raw diff: https://github.com/php/php-src/commit/9a89de1a274ce228c1795d1cebe292bb2a2e5194.diff
ext/openssl: applied fixers to improve test robustness (#23134)
Changed paths:
M ext/openssl/tests/bug38261.phpt
M ext/openssl/tests/bug60632.phpt
M ext/openssl/tests/bug68912.phpt
M ext/openssl/tests/bug71475.phpt
M ext/openssl/tests/bug81713.phpt
M ext/openssl/tests/gh22081.phpt
M ext/openssl/tests/memory_leak_x509_store.phpt
M ext/openssl/tests/openssl_cipher_iv_length_error.phpt
M ext/openssl/tests/openssl_cipher_key_length_error.phpt
M ext/openssl/tests/openssl_cms_decrypt_error.phpt
M ext/openssl/tests/openssl_cms_encrypt_der.phpt
M ext/openssl/tests/openssl_csr_export_basic.phpt
M ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
M ext/openssl/tests/openssl_csr_new_array_dn_entry.phpt
M ext/openssl/tests/openssl_csr_new_basic.phpt
M ext/openssl/tests/openssl_csr_new_with_attribs.phpt
M ext/openssl/tests/openssl_csr_sign_basic.phpt
M ext/openssl/tests/openssl_csr_sign_with_serial_hex.phpt
M ext/openssl/tests/openssl_pkcs12_export_basic.phpt
M ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
M ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
M ext/openssl/tests/openssl_pkey_new_error.phpt
M ext/openssl/tests/openssl_private_decrypt_basic.phpt
M ext/openssl/tests/openssl_private_decrypt_digest.phpt
M ext/openssl/tests/openssl_public_decrypt_basic.phpt
M ext/openssl/tests/openssl_random_pseudo_bytes_error.phpt
M ext/openssl/tests/openssl_seal_basic.phpt
M ext/openssl/tests/openssl_x509_export_basic.phpt
M ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
M ext/openssl/tests/openssl_x509_read_basic.phpt
M ext/openssl/tests/php_openssl_pkey_from_zval_leak.phpt
M ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt
M ext/openssl/tests/session_resumption_invalid_session_import.phpt
M ext/openssl/tests/tls_psk_callback_not_callable.phpt
M ext/openssl/tests/tls_psk_client_callback_null.phpt
M ext/openssl/tests/tls_psk_client_callback_throws.phpt
M ext/openssl/tests/tls_psk_client_no_identity.phpt
M ext/openssl/tests/tls_psk_mismatch.phpt
M ext/openssl/tests/tls_psk_tls13_unknown_identity.phpt
Diff:
diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt
index 6064380c8bca..582ebac054a8 100644
--- a/ext/openssl/tests/bug38261.phpt
+++ b/ext/openssl/tests/bug38261.phpt
@@ -16,28 +16,28 @@ var_dump(openssl_x509_parse("foo"));
try {
var_dump(openssl_x509_parse($t));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
openssl_x509_parse([]);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(openssl_x509_parse($cert));
try {
openssl_x509_parse(new stdClass);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
bool(false)
bool(false)
-openssl_x509_parse(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array
given
+TypeError: openssl_x509_parse(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, array given
bool(false)
-openssl_x509_parse(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string,
stdClass given
+TypeError: openssl_x509_parse(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, stdClass given
diff --git a/ext/openssl/tests/bug60632.phpt b/ext/openssl/tests/bug60632.phpt
index 7be90bd4ab43..0c0135621c35 100644
--- a/ext/openssl/tests/bug60632.phpt
+++ b/ext/openssl/tests/bug60632.phpt
@@ -20,9 +20,9 @@ $ekeys = array();
try {
$result = openssl_seal('test phrase', $encrypted, $ekeys, array($pubkey),
'AES-256-CBC');
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-openssl_seal(): Argument #6 ($iv) cannot be null for the chosen cipher algorithm
+ValueError: openssl_seal(): Argument #6 ($iv) cannot be null for the chosen cipher algorithm
diff --git a/ext/openssl/tests/bug68912.phpt b/ext/openssl/tests/bug68912.phpt
index 7bb8c9e5032b..b9b2c29c8785 100644
--- a/ext/openssl/tests/bug68912.phpt
+++ b/ext/openssl/tests/bug68912.phpt
@@ -15,9 +15,9 @@ $var3=3;
try {
openssl_spki_new($var1, $var2, $var3);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-openssl_spki_new(): Argument #1 ($private_key) must be of type OpenSSLAsymmetricKey, resource given
+TypeError: openssl_spki_new(): Argument #1 ($private_key) must be of type OpenSSLAsymmetricKey,
resource given
diff --git a/ext/openssl/tests/bug71475.phpt b/ext/openssl/tests/bug71475.phpt
index 354d0b4de27d..31b02cfd1efc 100644
--- a/ext/openssl/tests/bug71475.phpt
+++ b/ext/openssl/tests/bug71475.phpt
@@ -7,11 +7,11 @@ openssl
$_ = str_repeat("A", 512);
try {
openssl_seal($_, $_, $_, array_fill(0,64,0));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
DONE
--EXPECT--
-openssl_seal() expects at least 5 arguments, 4 given
+ArgumentCountError: openssl_seal() expects at least 5 arguments, 4 given
DONE
diff --git a/ext/openssl/tests/bug81713.phpt b/ext/openssl/tests/bug81713.phpt
index 9e3ab5d5e2f3..35b8f0444feb 100644
--- a/ext/openssl/tests/bug81713.phpt
+++ b/ext/openssl/tests/bug81713.phpt
@@ -129,8 +129,8 @@ foreach ($tests as $test) {
$key = call_user_func_array($test[0], array_slice($test, 1));
var_dump($key);
}
- catch (ValueError $e) {
- echo $e->getMessage() . PHP_EOL;
+ catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
}
?>
@@ -142,98 +142,98 @@ $outfile = __DIR__ . '/bug81713.out';
--EXPECTF--
object(OpenSSLAsymmetricKey)#1 (0) {
}
-openssl_pkey_get_public(): Argument #1 ($public_key) must not contain any null bytes
-openssl_pkey_get_private(): Argument #1 ($private_key) must not contain any null bytes
-openssl_pkey_export_to_file(): Argument #1 ($key) must not contain any null bytes
-openssl_pkey_export_to_file(): Argument #2 ($output_filename) must not contain any null bytes
-openssl_pkey_export(): Argument #1 ($key) must not contain any null bytes
-openssl_pkey_derive(): Argument #1 ($public_key) must not contain any null bytes
-openssl_pkey_derive(): Argument #2 ($private_key) must not contain any null bytes
-openssl_private_encrypt(): Argument #3 ($private_key) must not contain any null bytes
-openssl_private_decrypt(): Argument #3 ($private_key) must not contain any null bytes
-openssl_public_encrypt(): Argument #3 ($public_key) must not contain any null bytes
-openssl_public_decrypt(): Argument #3 ($public_key) must not contain any null bytes
-openssl_sign(): Argument #3 ($private_key) must not contain any null bytes
-openssl_verify(): Argument #3 ($public_key) must not contain any null bytes
-openssl_seal(): Argument #4 ($public_key) must not contain any null bytes
-openssl_open(): Argument #4 ($private_key) must not contain any null bytes
-openssl_csr_new(): Argument #2 ($private_key) must not contain any null bytes
-openssl_csr_get_subject(): Argument #1 ($csr) must not contain any null bytes
-openssl_csr_get_public_key(): Argument #1 ($csr) must not contain any null bytes
+ValueError: openssl_pkey_get_public(): Argument #1 ($public_key) must not contain any null bytes
+ValueError: openssl_pkey_get_private(): Argument #1 ($private_key) must not contain any null bytes
+ValueError: openssl_pkey_export_to_file(): Argument #1 ($key) must not contain any null bytes
+ValueError: openssl_pkey_export_to_file(): Argument #2 ($output_filename) must not contain any null
bytes
+ValueError: openssl_pkey_export(): Argument #1 ($key) must not contain any null bytes
+ValueError: openssl_pkey_derive(): Argument #1 ($public_key) must not contain any null bytes
+ValueError: openssl_pkey_derive(): Argument #2 ($private_key) must not contain any null bytes
+ValueError: openssl_private_encrypt(): Argument #3 ($private_key) must not contain any null bytes
+ValueError: openssl_private_decrypt(): Argument #3 ($private_key) must not contain any null bytes
+ValueError: openssl_public_encrypt(): Argument #3 ($public_key) must not contain any null bytes
+ValueError: openssl_public_decrypt(): Argument #3 ($public_key) must not contain any null bytes
+ValueError: openssl_sign(): Argument #3 ($private_key) must not contain any null bytes
+ValueError: openssl_verify(): Argument #3 ($public_key) must not contain any null bytes
+ValueError: openssl_seal(): Argument #4 ($public_key) must not contain any null bytes
+ValueError: openssl_open(): Argument #4 ($private_key) must not contain any null bytes
+ValueError: openssl_csr_new(): Argument #2 ($private_key) must not contain any null bytes
+ValueError: openssl_csr_get_subject(): Argument #1 ($csr) must not contain any null bytes
+ValueError: openssl_csr_get_public_key(): Argument #1 ($csr) must not contain any null bytes
Warning: openssl_x509_fingerprint(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_x509_fingerprint(): Argument #1 ($certificate) must not contain any null bytes
+ValueError: openssl_x509_fingerprint(): Argument #1 ($certificate) must not contain any null bytes
Warning: openssl_x509_export_to_file(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_x509_export_to_file(): Argument #1 ($certificate) must not contain any null bytes
-openssl_x509_export_to_file(): Argument #2 ($output_filename) must not contain any null bytes
+ValueError: openssl_x509_export_to_file(): Argument #1 ($certificate) must not contain any null
bytes
+ValueError: openssl_x509_export_to_file(): Argument #2 ($output_filename) must not contain any null
bytes
Warning: openssl_x509_export(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_x509_export(): Argument #1 ($certificate) must not contain any null bytes
-openssl_x509_checkpurpose(): Argument #1 ($certificate) must not contain any null bytes
-openssl_x509_checkpurpose(): Argument #3 ($ca_info) array item must not contain any null bytes
-openssl_x509_check_private_key(): Argument #1 ($certificate) must not contain any null bytes
-openssl_x509_check_private_key(): Argument #2 ($private_key) must not contain any null bytes
-openssl_x509_verify(): Argument #1 ($certificate) must not contain any null bytes
-openssl_x509_verify(): Argument #2 ($public_key) must not contain any null bytes
-openssl_x509_parse(): Argument #1 ($certificate) must not contain any null bytes
+ValueError: openssl_x509_export(): Argument #1 ($certificate) must not contain any null bytes
+ValueError: openssl_x509_checkpurpose(): Argument #1 ($certificate) must not contain any null bytes
+ValueError: openssl_x509_checkpurpose(): Argument #3 ($ca_info) array item must not contain any
null bytes
+ValueError: openssl_x509_check_private_key(): Argument #1 ($certificate) must not contain any null
bytes
+ValueError: openssl_x509_check_private_key(): Argument #2 ($private_key) must not contain any null
bytes
+ValueError: openssl_x509_verify(): Argument #1 ($certificate) must not contain any null bytes
+ValueError: openssl_x509_verify(): Argument #2 ($public_key) must not contain any null bytes
+ValueError: openssl_x509_parse(): Argument #1 ($certificate) must not contain any null bytes
Warning: openssl_x509_read(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_x509_read(): Argument #1 ($certificate) must not contain any null bytes
-openssl_cms_encrypt(): Argument #1 ($input_filename) must not contain any null bytes
-openssl_cms_encrypt(): Argument #2 ($output_filename) must not contain any null bytes
-openssl_cms_encrypt(): Argument #3 ($certificate) must not contain any null bytes
-openssl_cms_encrypt(): Argument #3 ($certificate) array item must not contain any null bytes
-openssl_cms_decrypt(): Argument #1 ($input_filename) must not contain any null bytes
-openssl_cms_decrypt(): Argument #2 ($output_filename) must not contain any null bytes
+ValueError: openssl_x509_read(): Argument #1 ($certificate) must not contain any null bytes
+ValueError: openssl_cms_encrypt(): Argument #1 ($input_filename) must not contain any null bytes
+ValueError: openssl_cms_encrypt(): Argument #2 ($output_filename) must not contain any null bytes
+ValueError: openssl_cms_encrypt(): Argument #3 ($certificate) must not contain any null bytes
+ValueError: openssl_cms_encrypt(): Argument #3 ($certificate) array item must not contain any null
bytes
+ValueError: openssl_cms_decrypt(): Argument #1 ($input_filename) must not contain any null bytes
+ValueError: openssl_cms_decrypt(): Argument #2 ($output_filename) must not contain any null bytes
Warning: openssl_cms_decrypt(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_cms_decrypt(): Argument #3 ($certificate) must not contain any null bytes
-openssl_cms_decrypt(): Argument #4 ($private_key) must not contain any null bytes
-openssl_cms_sign(): Argument #1 ($input_filename) must not contain any null bytes
-openssl_cms_sign(): Argument #2 ($output_filename) must not contain any null bytes
+ValueError: openssl_cms_decrypt(): Argument #3 ($certificate) must not contain any null bytes
+ValueError: openssl_cms_decrypt(): Argument #4 ($private_key) must not contain any null bytes
+ValueError: openssl_cms_sign(): Argument #1 ($input_filename) must not contain any null bytes
+ValueError: openssl_cms_sign(): Argument #2 ($output_filename) must not contain any null bytes
Warning: openssl_cms_sign(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_cms_sign(): Argument #3 ($certificate) must not contain any null bytes
-openssl_cms_sign(): Argument #4 ($private_key) must not contain any null bytes
-openssl_cms_sign(): Argument #8 ($untrusted_certificates_filename) must not contain any null bytes
-openssl_cms_verify(): Argument #1 ($input_filename) must not contain any null bytes
-openssl_cms_verify(): Argument #3 ($certificates) must not contain any null bytes
-openssl_cms_verify(): Argument #4 ($ca_info) array item must not contain any null bytes
-openssl_cms_verify(): Argument #5 ($untrusted_certificates_filename) must not contain any null
bytes
-openssl_cms_verify(): Argument #6 ($content) must not contain any null bytes
-openssl_cms_verify(): Argument #7 ($pk7) must not contain any null bytes
-openssl_pkcs7_encrypt(): Argument #1 ($input_filename) must not contain any null bytes
-openssl_pkcs7_encrypt(): Argument #2 ($output_filename) must not contain any null bytes
-openssl_pkcs7_encrypt(): Argument #3 ($certificate) must not contain any null bytes
-openssl_pkcs7_encrypt(): Argument #3 ($certificate) array item must not contain any null bytes
-openssl_pkcs7_decrypt(): Argument #1 ($input_filename) must not contain any null bytes
-openssl_pkcs7_decrypt(): Argument #2 ($output_filename) must not contain any null bytes
+ValueError: openssl_cms_sign(): Argument #3 ($certificate) must not contain any null bytes
+ValueError: openssl_cms_sign(): Argument #4 ($private_key) must not contain any null bytes
+ValueError: openssl_cms_sign(): Argument #8 ($untrusted_certificates_filename) must not contain any
null bytes
+ValueError: openssl_cms_verify(): Argument #1 ($input_filename) must not contain any null bytes
+ValueError: openssl_cms_verify(): Argument #3 ($certificates) must not contain any null bytes
+ValueError: openssl_cms_verify(): Argument #4 ($ca_info) array item must not contain any null bytes
+ValueError: openssl_cms_verify(): Argument #5 ($untrusted_certificates_filename) must not contain
any null bytes
+ValueError: openssl_cms_verify(): Argument #6 ($content) must not contain any null bytes
+ValueError: openssl_cms_verify(): Argument #7 ($pk7) must not contain any null bytes
+ValueError: openssl_pkcs7_encrypt(): Argument #1 ($input_filename) must not contain any null bytes
+ValueError: openssl_pkcs7_encrypt(): Argument #2 ($output_filename) must not contain any null bytes
+ValueError: openssl_pkcs7_encrypt(): Argument #3 ($certificate) must not contain any null bytes
+ValueError: openssl_pkcs7_encrypt(): Argument #3 ($certificate) array item must not contain any
null bytes
+ValueError: openssl_pkcs7_decrypt(): Argument #1 ($input_filename) must not contain any null bytes
+ValueError: openssl_pkcs7_decrypt(): Argument #2 ($output_filename) must not contain any null bytes
Warning: openssl_pkcs7_decrypt(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_pkcs7_decrypt(): Argument #3 ($certificate) must not contain any null bytes
-openssl_pkcs7_decrypt(): Argument #4 ($private_key) must not contain any null bytes
-openssl_pkcs7_sign(): Argument #1 ($input_filename) must not contain any null bytes
-openssl_pkcs7_sign(): Argument #2 ($output_filename) must not contain any null bytes
+ValueError: openssl_pkcs7_decrypt(): Argument #3 ($certificate) must not contain any null bytes
+ValueError: openssl_pkcs7_decrypt(): Argument #4 ($private_key) must not contain any null bytes
+ValueError: openssl_pkcs7_sign(): Argument #1 ($input_filename) must not contain any null bytes
+ValueError: openssl_pkcs7_sign(): Argument #2 ($output_filename) must not contain any null bytes
Warning: openssl_pkcs7_sign(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_pkcs7_sign(): Argument #3 ($certificate) must not contain any null bytes
-openssl_pkcs7_sign(): Argument #4 ($private_key) must not contain any null bytes
-openssl_pkcs7_sign(): Argument #7 ($untrusted_certificates_filename) must not contain any null
bytes
-openssl_pkcs7_verify(): Argument #1 ($input_filename) must not contain any null bytes
-openssl_pkcs7_verify(): Argument #3 ($signers_certificates_filename) must not contain any null
bytes
-openssl_pkcs7_verify(): Argument #4 ($ca_info) array item must not contain any null bytes
-openssl_pkcs7_verify(): Argument #5 ($untrusted_certificates_filename) must not contain any null
bytes
-openssl_pkcs7_verify(): Argument #6 ($content) must not contain any null bytes
-openssl_pkcs7_verify(): Argument #7 ($output_filename) must not contain any null bytes
+ValueError: openssl_pkcs7_sign(): Argument #3 ($certificate) must not contain any null bytes
+ValueError: openssl_pkcs7_sign(): Argument #4 ($private_key) must not contain any null bytes
+ValueError: openssl_pkcs7_sign(): Argument #7 ($untrusted_certificates_filename) must not contain
any null bytes
+ValueError: openssl_pkcs7_verify(): Argument #1 ($input_filename) must not contain any null bytes
+ValueError: openssl_pkcs7_verify(): Argument #3 ($signers_certificates_filename) must not contain
any null bytes
+ValueError: openssl_pkcs7_verify(): Argument #4 ($ca_info) array item must not contain any null
bytes
+ValueError: openssl_pkcs7_verify(): Argument #5 ($untrusted_certificates_filename) must not contain
any null bytes
+ValueError: openssl_pkcs7_verify(): Argument #6 ($content) must not contain any null bytes
+ValueError: openssl_pkcs7_verify(): Argument #7 ($output_filename) must not contain any null bytes
Warning: openssl_pkcs12_export(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_pkcs12_export(): Argument #1 ($certificate) must not contain any null bytes
-openssl_pkcs12_export(): Argument #3 ($private_key) must not contain any null bytes
-openssl_pkcs12_export(): Argument #5 ($options) option extracerts array item must not contain any
null bytes
+ValueError: openssl_pkcs12_export(): Argument #1 ($certificate) must not contain any null bytes
+ValueError: openssl_pkcs12_export(): Argument #3 ($private_key) must not contain any null bytes
+ValueError: openssl_pkcs12_export(): Argument #5 ($options) option extracerts array item must not
contain any null bytes
Warning: openssl_pkcs12_export_to_file(): X.509 Certificate cannot be retrieved in %s on line %d
-openssl_pkcs12_export_to_file(): Argument #1 ($certificate) must not contain any null bytes
-openssl_pkcs12_export_to_file(): Argument #2 ($output_filename) must not contain any null bytes
-openssl_pkcs12_export_to_file(): Argument #3 ($private_key) must not contain any null bytes
-openssl_pkcs12_export_to_file(): Argument #5 ($options) option extracerts array item must not
contain any null bytes
+ValueError: openssl_pkcs12_export_to_file(): Argument #1 ($certificate) must not contain any null
bytes
+ValueError: openssl_pkcs12_export_to_file(): Argument #2 ($output_filename) must not contain any
null bytes
+ValueError: openssl_pkcs12_export_to_file(): Argument #3 ($private_key) must not contain any null
bytes
+ValueError: openssl_pkcs12_export_to_file(): Argument #5 ($options) option extracerts array item
must not contain any null bytes
diff --git a/ext/openssl/tests/gh22081.phpt b/ext/openssl/tests/gh22081.phpt
index 17f74be7584c..f8069bc180f7 100644
--- a/ext/openssl/tests/gh22081.phpt
+++ b/ext/openssl/tests/gh22081.phpt
@@ -73,4 +73,3 @@ ok 1
ok 2
ok 3
ok 4
-
diff --git a/ext/openssl/tests/memory_leak_x509_store.phpt
b/ext/openssl/tests/memory_leak_x509_store.phpt
index bc9b113602a3..253283107033 100644
--- a/ext/openssl/tests/memory_leak_x509_store.phpt
+++ b/ext/openssl/tests/memory_leak_x509_store.phpt
@@ -13,10 +13,10 @@ class MyStringable{
try {
openssl_pkcs7_verify("does not matter", 0, "does not matter", [new
MyStringable]);
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-stop
+Error: stop
diff --git a/ext/openssl/tests/openssl_cipher_iv_length_error.phpt
b/ext/openssl/tests/openssl_cipher_iv_length_error.phpt
index cdd5f3616fb2..1464b7b75770 100644
--- a/ext/openssl/tests/openssl_cipher_iv_length_error.phpt
+++ b/ext/openssl/tests/openssl_cipher_iv_length_error.phpt
@@ -9,13 +9,12 @@ var_dump(openssl_cipher_iv_length('unknown'));
try {
var_dump(openssl_cipher_iv_length(''));
-} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-
Warning: openssl_cipher_iv_length(): Unknown cipher algorithm in %s on line %d
bool(false)
-openssl_cipher_iv_length(): Argument #1 ($cipher_algo) must not be empty
+ValueError: openssl_cipher_iv_length(): Argument #1 ($cipher_algo) must not be empty
diff --git a/ext/openssl/tests/openssl_cipher_key_length_error.phpt
b/ext/openssl/tests/openssl_cipher_key_length_error.phpt
index a4e4e8e6bfcf..5cf147acd628 100644
--- a/ext/openssl/tests/openssl_cipher_key_length_error.phpt
+++ b/ext/openssl/tests/openssl_cipher_key_length_error.phpt
@@ -9,13 +9,12 @@ var_dump(openssl_cipher_key_length('unknown'));
try {
var_dump(openssl_cipher_key_length(''));
-} catch (ValueError $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
-
Warning: openssl_cipher_key_length(): Unknown cipher algorithm in %s on line %d
bool(false)
-openssl_cipher_key_length(): Argument #1 ($cipher_algo) must not be empty
+ValueError: openssl_cipher_key_length(): Argument #1 ($cipher_algo) must not be empty
diff --git a/ext/openssl/tests/openssl_cms_decrypt_error.phpt
b/ext/openssl/tests/openssl_cms_decrypt_error.phpt
index 3c128be64d09..78cf4e4c9d4b 100644
--- a/ext/openssl/tests/openssl_cms_decrypt_error.phpt
+++ b/ext/openssl/tests/openssl_cms_decrypt_error.phpt
@@ -17,8 +17,8 @@ $d = new stdclass;
try {
var_dump(openssl_cms_decrypt($a, $b, $c, $d));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($c);
@@ -30,7 +30,7 @@ var_dump(openssl_cms_decrypt($a, $b, 0, 0));
echo "Done\n";
?>
--EXPECT--
-Object of class stdClass could not be converted to string
+Error: Object of class stdClass could not be converted to string
object(stdClass)#1 (0) {
}
string(60) "openssl_cms_decrypt(): X.509 Certificate cannot be retrieved"
diff --git a/ext/openssl/tests/openssl_cms_encrypt_der.phpt
b/ext/openssl/tests/openssl_cms_encrypt_der.phpt
index 2f26428c2a64..11985a367ae4 100644
--- a/ext/openssl/tests/openssl_cms_encrypt_der.phpt
+++ b/ext/openssl/tests/openssl_cms_encrypt_der.phpt
@@ -46,4 +46,3 @@ bool(true)
Now is the winter of our discontent.
true
true
-
diff --git a/ext/openssl/tests/openssl_csr_export_basic.phpt
b/ext/openssl/tests/openssl_csr_export_basic.phpt
index f64271ffd971..8188e29cbf21 100644
--- a/ext/openssl/tests/openssl_csr_export_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_export_basic.phpt
@@ -33,13 +33,13 @@ $csr = openssl_csr_new($dn, $privkey, $args);
var_dump(openssl_csr_export($csr, $output));
try {
var_dump(openssl_csr_export($wrong, $output));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(openssl_csr_export($privkey, $output));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(openssl_csr_export($csr, $output, false));
?>
@@ -48,5 +48,5 @@ bool(true)
Warning: openssl_csr_export(): X.509 Certificate Signing Request cannot be retrieved in %s on line
%d
bool(false)
-openssl_csr_export(): Argument #1 ($csr) must be of type OpenSSLCertificateSigningRequest|string,
OpenSSLAsymmetricKey given
+TypeError: openssl_csr_export(): Argument #1 ($csr) must be of type
OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given
bool(true)
diff --git a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
index 4a6a393a6ba2..f90ebf3563fd 100644
--- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
@@ -45,8 +45,8 @@ var_dump(openssl_csr_export_to_file($wrong, $csrfile));
try {
openssl_csr_export_to_file($dh, $csrfile);
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(openssl_csr_export_to_file($csr, $csrfile, false));
?>
@@ -81,5 +81,5 @@ f1JMPX0/eHrKvG9wBZu28FdS54xoWGeD1NGraW24
Warning: openssl_csr_export_to_file(): X.509 Certificate Signing Request cannot be retrieved in %s
on line %d
bool(false)
-openssl_csr_export_to_file(): Argument #1 ($csr) must be of type
OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given
+TypeError: openssl_csr_export_to_file(): Argument #1 ($csr) must be of type
OpenSSLCertificateSigningRequest|string, OpenSSLAsymmetricKey given
bool(true)
diff --git a/ext/openssl/tests/openssl_csr_new_array_dn_entry.phpt
b/ext/openssl/tests/openssl_csr_new_array_dn_entry.phpt
index 7184c9af48d5..0f8f3540fa53 100644
--- a/ext/openssl/tests/openssl_csr_new_array_dn_entry.phpt
+++ b/ext/openssl/tests/openssl_csr_new_array_dn_entry.phpt
@@ -56,4 +56,4 @@ array(7) {
string(12) "test.php.net"
["emailAddress"]=>
string(20) "php.test@example.com"
-}
\ No newline at end of file
+}
diff --git a/ext/openssl/tests/openssl_csr_new_basic.phpt
b/ext/openssl/tests/openssl_csr_new_basic.phpt
index 66a30584e5a7..ed51b928eabc 100644
--- a/ext/openssl/tests/openssl_csr_new_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_new_basic.phpt
@@ -12,8 +12,8 @@ $conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR .
'openssl.cnf');
try {
var_dump(openssl_csr_new(array(), $a, $conf, array()));
var_dump($keyFailed);
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// this leaks
@@ -28,7 +28,7 @@ var_dump(openssl_csr_new(["countryName" => "DE"], $x, $conf
+ ["x509_extensions"
?>
--EXPECTF--
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
-Key array must be of the form array(0 => key, 1 => phrase)
+ValueError: Key array must be of the form array(0 => key, 1 => phrase)
object(OpenSSLCertificateSigningRequest)#%d (0) {
}
object(OpenSSLCertificateSigningRequest)#%d (0) {
diff --git a/ext/openssl/tests/openssl_csr_new_with_attribs.phpt
b/ext/openssl/tests/openssl_csr_new_with_attribs.phpt
index a031b9d4a661..f8d4b2fc3c15 100644
--- a/ext/openssl/tests/openssl_csr_new_with_attribs.phpt
+++ b/ext/openssl/tests/openssl_csr_new_with_attribs.phpt
@@ -91,4 +91,4 @@ UeEz+fvmQ4L+sc3RE8u+M8g31LM=
Warning: openssl_csr_new(): attributes: wrong is not a recognized attribute name in %s on line %d
object(OpenSSLCertificateSigningRequest)#%d (0) {
-}
\ No newline at end of file
+}
diff --git a/ext/openssl/tests/openssl_csr_sign_basic.phpt
b/ext/openssl/tests/openssl_csr_sign_basic.phpt
index 852b296b9e04..cdcb48529581 100644
--- a/ext/openssl/tests/openssl_csr_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt
@@ -44,20 +44,20 @@ var_dump(openssl_csr_sign($wrong, null, $privkey, 365));
try {
openssl_csr_sign(array(), null, $privkey, 365);
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(openssl_csr_sign($csr, array(), $privkey, 365));
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
var_dump(openssl_csr_sign($csr, null, array(), 365));
-} catch (ValueError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
var_dump(openssl_csr_sign($csr, null, $privkey, 365, $config_arg));
?>
@@ -79,8 +79,8 @@ bool(false)
Warning: openssl_csr_sign(): X.509 Certificate Signing Request cannot be retrieved in %s on line %d
bool(false)
-openssl_csr_sign(): Argument #1 ($csr) must be of type OpenSSLCertificateSigningRequest|string,
array given
-openssl_csr_sign(): Argument #2 ($ca_certificate) must be of type OpenSSLCertificate|string|null,
array given
-Key array must be of the form array(0 => key, 1 => phrase)
+TypeError: openssl_csr_sign(): Argument #1 ($csr) must be of type
OpenSSLCertificateSigningRequest|string, array given
+TypeError: openssl_csr_sign(): Argument #2 ($ca_certificate) must be of type
OpenSSLCertificate|string|null, array given
+ValueError: Key array must be of the form array(0 => key, 1 => phrase)
object(OpenSSLCertificate)#%d (0) {
}
diff --git a/ext/openssl/tests/openssl_csr_sign_with_serial_hex.phpt
b/ext/openssl/tests/openssl_csr_sign_with_serial_hex.phpt
index eec1bbdcfc4c..56084838b10a 100644
--- a/ext/openssl/tests/openssl_csr_sign_with_serial_hex.phpt
+++ b/ext/openssl/tests/openssl_csr_sign_with_serial_hex.phpt
@@ -62,4 +62,4 @@ string(6) "12D687"
string(10) "3735928559"
string(8) "DEADBEEF"
string(42) "0xDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"
-string(40) "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"
\ No newline at end of file
+string(40) "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"
diff --git a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
index 458f365fc14b..3db9b860095d 100644
--- a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
@@ -32,8 +32,8 @@ var_dump(openssl_pkcs12_export($invalid, $output, $invalid, $pass));
var_dump(openssl_pkcs12_export($invalid_path, $output, $invalid_path, $pass));
try {
var_dump(openssl_pkcs12_export($priv_res, $output, $cert_res, $pass));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
//var_dump(openssl_pkcs12_export($cert, $output, $priv, $pass, array("foo")));
?>
@@ -53,4 +53,4 @@ bool(false)
Warning: openssl_pkcs12_export(): X.509 Certificate cannot be retrieved in %s on line %d
bool(false)
-openssl_pkcs12_export(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string,
OpenSSLAsymmetricKey given
+TypeError: openssl_pkcs12_export(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, OpenSSLAsymmetricKey given
diff --git a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
index 0938921a8ff5..82e07f5a4c4e 100644
--- a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
@@ -32,8 +32,8 @@ var_dump(openssl_pkcs12_export_to_file($invalid, $pkcsfile, $invalid, $pass));
var_dump(openssl_pkcs12_export_to_file($invalid_path, $pkcsfile, $invalid_path, $pass));
try {
var_dump(openssl_pkcs12_export_to_file($priv_res, $pkcsfile, $cert_res, $pass));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--CLEAN--
@@ -58,4 +58,4 @@ bool(false)
Warning: openssl_pkcs12_export_to_file(): X.509 Certificate cannot be retrieved in %s on line %d
bool(false)
-openssl_pkcs12_export_to_file(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, OpenSSLAsymmetricKey given
+TypeError: openssl_pkcs12_export_to_file(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, OpenSSLAsymmetricKey given
diff --git a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
index 480e662e4145..ed70c27f1a0a 100644
--- a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
@@ -17,8 +17,8 @@ $d = new stdclass;
try {
var_dump(openssl_pkcs7_decrypt($a, $b, $c, $d));
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($c);
@@ -30,7 +30,7 @@ var_dump(openssl_pkcs7_decrypt($a, $b, 0, 0));
echo "Done\n";
?>
--EXPECT--
-Object of class stdClass could not be converted to string
+Error: Object of class stdClass could not be converted to string
object(stdClass)#1 (0) {
}
string(62) "openssl_pkcs7_decrypt(): X.509 Certificate cannot be retrieved"
diff --git a/ext/openssl/tests/openssl_pkey_new_error.phpt
b/ext/openssl/tests/openssl_pkey_new_error.phpt
index f32292677bac..764c4547e4fe 100644
--- a/ext/openssl/tests/openssl_pkey_new_error.phpt
+++ b/ext/openssl/tests/openssl_pkey_new_error.phpt
@@ -13,21 +13,21 @@ $dh = array("dh" => array());
try {
openssl_pkey_get_details(openssl_pkey_new($rsa));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
openssl_pkey_get_details(openssl_pkey_new($dsa));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
openssl_pkey_get_details(openssl_pkey_new($dh));
-} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-openssl_pkey_get_details(): Argument #1 ($key) must be of type OpenSSLAsymmetricKey, false given
-openssl_pkey_get_details(): Argument #1 ($key) must be of type OpenSSLAsymmetricKey, false given
-openssl_pkey_get_details(): Argument #1 ($key) must be of type OpenSSLAsymmetricKey, false given
+TypeError: openssl_pkey_get_details(): Argument #1 ($key) must be of type OpenSSLAsymmetricKey,
false given
+TypeError: openssl_pkey_get_details(): Argument #1 ($key) must be of type OpenSSLAsymmetricKey,
false given
+TypeError: openssl_pkey_get_details(): Argument #1 ($key) must be of type OpenSSLAsymmetricKey,
false given
diff --git a/ext/openssl/tests/openssl_private_decrypt_basic.phpt
b/ext/openssl/tests/openssl_private_decrypt_basic.phpt
index 44101d580c02..97250254085d 100644
--- a/ext/openssl/tests/openssl_private_decrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_private_decrypt_basic.phpt
@@ -20,8 +20,8 @@ var_dump($output3);
try {
var_dump(openssl_private_decrypt($encrypted, $output4, array($privkey),
OPENSSL_PKCS1_OAEP_PADDING));
var_dump($output4);
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(openssl_private_decrypt($encrypted, $output5, array($privkey, ""),
OPENSSL_PKCS1_OAEP_PADDING));
@@ -36,6 +36,6 @@ bool(false)
NULL
bool(false)
NULL
-Key array must be of the form array(0 => key, 1 => phrase)
+ValueError: Key array must be of the form array(0 => key, 1 => phrase)
bool(true)
string(32) "Testing openssl_public_decrypt()"
diff --git a/ext/openssl/tests/openssl_private_decrypt_digest.phpt
b/ext/openssl/tests/openssl_private_decrypt_digest.phpt
index 9bb07ba71eac..d90860aa3a77 100644
--- a/ext/openssl/tests/openssl_private_decrypt_digest.phpt
+++ b/ext/openssl/tests/openssl_private_decrypt_digest.phpt
@@ -33,8 +33,8 @@ var_dump($output_invalid);
try {
var_dump(openssl_private_decrypt($encrypted_sha256, $output_invalid, $privkey,
OPENSSL_PKCS1_OAEP_PADDING, "sha256\0extra"));
var_dump($output_invalid);
-} catch (\ValueError $e) {
- var_dump($e->getMessage());
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
openssl_public_encrypt($data, $encrypted_pkcs1, $pubkey, OPENSSL_PKCS1_PADDING);
@@ -52,6 +52,6 @@ NULL
Warning: openssl_private_decrypt(): Unknown digest algorithm: invalid_hash in %s on line %d
bool(false)
NULL
-string(85) "openssl_private_decrypt(): Argument #5 ($digest_algo) must not contain any null
bytes"
+ValueError: openssl_private_decrypt(): Argument #5 ($digest_algo) must not contain any null bytes
bool(true)
string(56) "Testing openssl_private_decrypt() with digest algorithms"
diff --git a/ext/openssl/tests/openssl_public_decrypt_basic.phpt
b/ext/openssl/tests/openssl_public_decrypt_basic.phpt
index 8a3f0f2c58d7..f021758dc205 100644
--- a/ext/openssl/tests/openssl_public_decrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_public_decrypt_basic.phpt
@@ -20,15 +20,15 @@ var_dump($output3);
try {
var_dump(openssl_public_decrypt($encrypted, $output4, array()));
var_dump($output4);
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
var_dump(openssl_public_decrypt($encrypted, $output5, array($pubkey)));
var_dump($output5);
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(openssl_public_decrypt($encrypted, $output6, array($pubkey, "")));
var_dump($output6);
@@ -42,7 +42,7 @@ bool(false)
NULL
bool(false)
NULL
-Key array must be of the form array(0 => key, 1 => phrase)
-Key array must be of the form array(0 => key, 1 => phrase)
+ValueError: Key array must be of the form array(0 => key, 1 => phrase)
+ValueError: Key array must be of the form array(0 => key, 1 => phrase)
bool(true)
string(32) "Testing openssl_public_decrypt()"
diff --git a/ext/openssl/tests/openssl_random_pseudo_bytes_error.phpt
b/ext/openssl/tests/openssl_random_pseudo_bytes_error.phpt
index 9f905e6a3510..18ba07aeb35f 100644
--- a/ext/openssl/tests/openssl_random_pseudo_bytes_error.phpt
+++ b/ext/openssl/tests/openssl_random_pseudo_bytes_error.phpt
@@ -6,9 +6,9 @@ openssl
<?php
try {
openssl_random_pseudo_bytes(0);
-} catch (Error $e) {
- echo $e->getMessage().PHP_EOL;
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-openssl_random_pseudo_bytes(): Argument #1 ($length) must be greater than 0
+ValueError: openssl_random_pseudo_bytes(): Argument #1 ($length) must be greater than 0
diff --git a/ext/openssl/tests/openssl_seal_basic.phpt b/ext/openssl/tests/openssl_seal_basic.phpt
index 6c08efa6d70d..37a15f27081b 100644
--- a/ext/openssl/tests/openssl_seal_basic.phpt
+++ b/ext/openssl/tests/openssl_seal_basic.phpt
@@ -15,8 +15,8 @@ var_dump(openssl_seal($a, $b, $c, $d, $method));
try {
var_dump(openssl_seal($a, $a, $a, array(), $method));
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// tests with cert
@@ -30,8 +30,8 @@ var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong), $method))
try {
var_dump(openssl_seal($data, $sealed, $ekeys, array(), $method));
-} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+} catch (\Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong), $method));
@@ -40,13 +40,13 @@ var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong), $method));
--EXPECTF--
Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s on line %d
bool(false)
-openssl_seal(): Argument #4 ($public_key) must not be empty
+ValueError: openssl_seal(): Argument #4 ($public_key) must not be empty
int(32)
int(32)
Warning: openssl_seal(): Not a public key (2th member of pubkeys) in %s on line %d
bool(false)
-openssl_seal(): Argument #4 ($public_key) must not be empty
+ValueError: openssl_seal(): Argument #4 ($public_key) must not be empty
Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/openssl_x509_export_basic.phpt
b/ext/openssl/tests/openssl_x509_export_basic.phpt
index f4b96fb9df24..86f039d5fb50 100644
--- a/ext/openssl/tests/openssl_x509_export_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_export_basic.phpt
@@ -19,8 +19,8 @@ var_dump(openssl_x509_export($d, $output4)); // read cert from a resource
try {
openssl_x509_export($e, $output5); // read an array, fails
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
if (PHP_EOL !== "\n") {
@@ -40,7 +40,7 @@ bool(true)
Warning: openssl_x509_export(): X.509 Certificate cannot be retrieved in %s on line %d
bool(false)
bool(true)
-openssl_x509_export(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array
given
+TypeError: openssl_x509_export(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, array given
int(0)
int(0)
int(%d)
diff --git a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
index 9fe8abfa4569..0fa60fe046c0 100644
--- a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
@@ -19,8 +19,8 @@ var_dump(openssl_x509_export_to_file($c, $outfilename)); // read an invalid cert
var_dump(openssl_x509_export_to_file($d, $outfilename)); // read cert from a resource
try {
openssl_x509_export_to_file($e, $outfilename); // read an array, fails
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
echo "---\n";
var_dump($exists = file_exists($outfilename));
@@ -39,6 +39,6 @@ bool(true)
Warning: openssl_x509_export_to_file(): X.509 Certificate cannot be retrieved in %s on line %d
bool(false)
bool(true)
-openssl_x509_export_to_file(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, array given
+TypeError: openssl_x509_export_to_file(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, array given
---
bool(true)
diff --git a/ext/openssl/tests/openssl_x509_read_basic.phpt
b/ext/openssl/tests/openssl_x509_read_basic.phpt
index 5eaf4ce8eb63..4e99aaede058 100644
--- a/ext/openssl/tests/openssl_x509_read_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_read_basic.phpt
@@ -21,14 +21,14 @@ var_dump(openssl_x509_read($d)); // read cert from a resource
try {
openssl_x509_read($e); // read an array
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
openssl_x509_read($f); // read an array with the filename
-} catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
+} catch (Throwable $exception) {
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
?>
@@ -42,5 +42,5 @@ Warning: openssl_x509_read(): X.509 Certificate cannot be retrieved in %s on lin
bool(false)
object(OpenSSLCertificate)#%d (0) {
}
-openssl_x509_read(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array
given
-openssl_x509_read(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array
given
+TypeError: openssl_x509_read(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, array given
+TypeError: openssl_x509_read(): Argument #1 ($certificate) must be of type
OpenSSLCertificate|string, array given
diff --git a/ext/openssl/tests/php_openssl_pkey_from_zval_leak.phpt
b/ext/openssl/tests/php_openssl_pkey_from_zval_leak.phpt
index 2b19dd311150..fbabc3aefca8 100644
--- a/ext/openssl/tests/php_openssl_pkey_from_zval_leak.phpt
+++ b/ext/openssl/tests/php_openssl_pkey_from_zval_leak.phpt
@@ -14,10 +14,10 @@ class StrFail {
$key = ["", new StrFail];
try {
openssl_pkey_export_to_file($key, "doesnotmatter");
-} catch (Error $e) {
- echo $e->getMessage(), "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-create a leak
+Error: create a leak
diff --git a/ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt
b/ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt
index f87f831a7859..74db2f3474ba 100644
--- a/ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt
+++ b/ext/openssl/tests/session_resumption_get_cb_no_ticket.phpt
@@ -76,4 +76,3 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
SERVER_EXCEPTION: Session tickets cannot be enabled when session_get_cb is setConnection failed as
expected
-
diff --git a/ext/openssl/tests/session_resumption_invalid_session_import.phpt
b/ext/openssl/tests/session_resumption_invalid_session_import.phpt
index efd49e7c693b..582761e7561e 100644
--- a/ext/openssl/tests/session_resumption_invalid_session_import.phpt
+++ b/ext/openssl/tests/session_resumption_invalid_session_import.phpt
@@ -11,9 +11,9 @@ if (!function_exists("proc_open")) die("skip no proc_open");
try {
Openssl\Session::import('invalid');
-} catch (Openssl\OpensslException $e) {
- echo $e->getMessage() . "\n";
+} catch (Throwable $e) {
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Failed to import session data
+Openssl\OpensslException: Failed to import session data
diff --git a/ext/openssl/tests/tls_psk_callback_not_callable.phpt
b/ext/openssl/tests/tls_psk_callback_not_callable.phpt
index 29382e2a13ab..14b2a0508e51 100644
--- a/ext/openssl/tests/tls_psk_callback_not_callable.phpt
+++ b/ext/openssl/tests/tls_psk_callback_not_callable.phpt
@@ -43,4 +43,3 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
caught: psk_client_cb must be a valid callback, %s
-
diff --git a/ext/openssl/tests/tls_psk_client_callback_null.phpt
b/ext/openssl/tests/tls_psk_client_callback_null.phpt
index 92d970908c8e..e7acdf77094b 100644
--- a/ext/openssl/tests/tls_psk_client_callback_null.phpt
+++ b/ext/openssl/tests/tls_psk_client_callback_null.phpt
@@ -42,4 +42,3 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
bool(false)
-
diff --git a/ext/openssl/tests/tls_psk_client_callback_throws.phpt
b/ext/openssl/tests/tls_psk_client_callback_throws.phpt
index 13b2d71476c2..350756130b14 100644
--- a/ext/openssl/tests/tls_psk_client_callback_throws.phpt
+++ b/ext/openssl/tests/tls_psk_client_callback_throws.phpt
@@ -45,4 +45,3 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
caught: callback boom
-
diff --git a/ext/openssl/tests/tls_psk_client_no_identity.phpt
b/ext/openssl/tests/tls_psk_client_no_identity.phpt
index bfc8d078ceff..8a84d822b4c1 100644
--- a/ext/openssl/tests/tls_psk_client_no_identity.phpt
+++ b/ext/openssl/tests/tls_psk_client_no_identity.phpt
@@ -46,4 +46,3 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
caught: Client PSK callback must return Openssl\Psk with a non-null identity
-
diff --git a/ext/openssl/tests/tls_psk_mismatch.phpt b/ext/openssl/tests/tls_psk_mismatch.phpt
index 8fa90d115c5a..ada49402bbde 100644
--- a/ext/openssl/tests/tls_psk_mismatch.phpt
+++ b/ext/openssl/tests/tls_psk_mismatch.phpt
@@ -41,4 +41,3 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
bool(false)
-
diff --git a/ext/openssl/tests/tls_psk_tls13_unknown_identity.phpt
b/ext/openssl/tests/tls_psk_tls13_unknown_identity.phpt
index 830c02449dc9..ddd05fd37ab4 100644
--- a/ext/openssl/tests/tls_psk_tls13_unknown_identity.phpt
+++ b/ext/openssl/tests/tls_psk_tls13_unknown_identity.phpt
@@ -41,4 +41,3 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
bool(false)
-