Commit 9a89de1a274 for php.net
commit 9a89de1a274ce228c1795d1cebe292bb2a2e5194
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Sun Sep 6 20:04:06 2026 +0700
ext/openssl: applied fixers to improve test robustness (#23134)
diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt
index 6064380c8bc..582ebac054a 100644
--- a/ext/openssl/tests/bug38261.phpt
+++ b/ext/openssl/tests/bug38261.phpt
@@ -16,28 +16,28 @@ function __toString() {
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 7be90bd4ab4..0c0135621c3 100644
--- a/ext/openssl/tests/bug60632.phpt
+++ b/ext/openssl/tests/bug60632.phpt
@@ -20,9 +20,9 @@
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 7bb8c9e5032..b9b2c29c878 100644
--- a/ext/openssl/tests/bug68912.phpt
+++ b/ext/openssl/tests/bug68912.phpt
@@ -15,9 +15,9 @@
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 354d0b4de27..31b02cfd1ef 100644
--- a/ext/openssl/tests/bug71475.phpt
+++ b/ext/openssl/tests/bug71475.phpt
@@ -7,11 +7,11 @@
$_ = 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 9e3ab5d5e2f..35b8f0444fe 100644
--- a/ext/openssl/tests/bug81713.phpt
+++ b/ext/openssl/tests/bug81713.phpt
@@ -129,8 +129,8 @@
$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 @@
--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 17f74be7584..f8069bc180f 100644
--- a/ext/openssl/tests/gh22081.phpt
+++ b/ext/openssl/tests/gh22081.phpt
@@ -73,4 +73,3 @@
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 bc9b113602a..25328310703 100644
--- a/ext/openssl/tests/memory_leak_x509_store.phpt
+++ b/ext/openssl/tests/memory_leak_x509_store.phpt
@@ -13,10 +13,10 @@ public function __toString(): string {
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 cdd5f3616fb..1464b7b7577 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 @@
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 a4e4e8e6bfc..5cf147acd62 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 @@
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 3c128be64d0..78cf4e4c9d4 100644
--- a/ext/openssl/tests/openssl_cms_decrypt_error.phpt
+++ b/ext/openssl/tests/openssl_cms_decrypt_error.phpt
@@ -17,8 +17,8 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
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 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
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 2f26428c2a6..11985a367ae 100644
--- a/ext/openssl/tests/openssl_cms_encrypt_der.phpt
+++ b/ext/openssl/tests/openssl_cms_encrypt_der.phpt
@@ -46,4 +46,3 @@
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 f64271ffd97..8188e29cbf2 100644
--- a/ext/openssl/tests/openssl_csr_export_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_export_basic.phpt
@@ -33,13 +33,13 @@
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 @@
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 4a6a393a6ba..f90ebf3563f 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 @@
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 @@
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 7184c9af48d..0f8f3540fa5 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 @@
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 66a30584e5a..ed51b928eab 100644
--- a/ext/openssl/tests/openssl_csr_new_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_new_basic.phpt
@@ -12,8 +12,8 @@
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 @@
?>
--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 a031b9d4a66..f8d4b2fc3c1 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 @@
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 852b296b9e0..cdcb4852958 100644
--- a/ext/openssl/tests/openssl_csr_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt
@@ -44,20 +44,20 @@
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 @@
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 eec1bbdcfc4..56084838b10 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(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 458f365fc14..3db9b860095 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_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 @@
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 0938921a8ff..82e07f5a4c4 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_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 @@
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 480e662e414..ed70c27f1a0 100644
--- a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
@@ -17,8 +17,8 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
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 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
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 f32292677ba..764c4547e4f 100644
--- a/ext/openssl/tests/openssl_pkey_new_error.phpt
+++ b/ext/openssl/tests/openssl_pkey_new_error.phpt
@@ -13,21 +13,21 @@
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 44101d580c0..97250254085 100644
--- a/ext/openssl/tests/openssl_private_decrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_private_decrypt_basic.phpt
@@ -20,8 +20,8 @@
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 @@
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 9bb07ba71ea..d90860aa3a7 100644
--- a/ext/openssl/tests/openssl_private_decrypt_digest.phpt
+++ b/ext/openssl/tests/openssl_private_decrypt_digest.phpt
@@ -33,8 +33,8 @@
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 @@
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 8a3f0f2c58d..f021758dc20 100644
--- a/ext/openssl/tests/openssl_public_decrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_public_decrypt_basic.phpt
@@ -20,15 +20,15 @@
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 @@
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 9f905e6a351..18ba07aeb35 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 @@
<?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 6c08efa6d70..37a15f27081 100644
--- a/ext/openssl/tests/openssl_seal_basic.phpt
+++ b/ext/openssl/tests/openssl_seal_basic.phpt
@@ -15,8 +15,8 @@
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 @@
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 @@
--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 f4b96fb9df2..86f039d5fb5 100644
--- a/ext/openssl/tests/openssl_x509_export_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_export_basic.phpt
@@ -19,8 +19,8 @@
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 @@
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 9fe8abfa456..0fa60fe046c 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($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 @@
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 5eaf4ce8eb6..4e99aaede05 100644
--- a/ext/openssl/tests/openssl_x509_read_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_read_basic.phpt
@@ -21,14 +21,14 @@
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 @@
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 2b19dd31115..fbabc3aefca 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 @@ public function __toString(): string {
$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 f87f831a785..74db2f3474b 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 @@
?>
--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 efd49e7c693..582761e7561 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 @@
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 29382e2a13a..14b2a0508e5 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 @@
?>
--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 92d970908c8..e7acdf77094 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 @@
?>
--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 13b2d71476c..350756130b1 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 @@
?>
--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 bfc8d078cef..8a84d822b4c 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 @@
?>
--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 8fa90d115c5..ada49402bbd 100644
--- a/ext/openssl/tests/tls_psk_mismatch.phpt
+++ b/ext/openssl/tests/tls_psk_mismatch.phpt
@@ -41,4 +41,3 @@
?>
--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 830c02449dc..ddd05fd37ab 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 @@
?>
--EXPECT--
bool(false)
-