From 3a2c0f9e0a4e4fdb6c90f43e7f265fed0cfbc0a5 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Fri, 7 Aug 2026 15:15:31 +0000 Subject: [PATCH] ext/openssl: applied fixers to improve test robustness --- ext/openssl/tests/bug38261.phpt | 10 +- ext/openssl/tests/bug60632.phpt | 4 +- ext/openssl/tests/bug68912.phpt | 4 +- ext/openssl/tests/bug71475.phpt | 4 +- ext/openssl/tests/bug81713.phpt | 152 +++++++++--------- ext/openssl/tests/gh22081.phpt | 1 - ext/openssl/tests/memory_leak_x509_store.phpt | 4 +- .../tests/openssl_cipher_iv_length_error.phpt | 5 +- .../openssl_cipher_key_length_error.phpt | 5 +- .../tests/openssl_cms_decrypt_error.phpt | 4 +- .../tests/openssl_cms_encrypt_der.phpt | 1 - .../tests/openssl_csr_export_basic.phpt | 6 +- .../openssl_csr_export_to_file_basic.phpt | 4 +- .../tests/openssl_csr_new_array_dn_entry.phpt | 2 +- ext/openssl/tests/openssl_csr_new_basic.phpt | 4 +- .../tests/openssl_csr_new_with_attribs.phpt | 2 +- ext/openssl/tests/openssl_csr_sign_basic.phpt | 12 +- .../openssl_csr_sign_with_serial_hex.phpt | 2 +- .../tests/openssl_pkcs12_export_basic.phpt | 4 +- .../openssl_pkcs12_export_to_file_basic.phpt | 4 +- .../tests/openssl_pkcs12_read_array_init.phpt | 2 +- .../tests/openssl_pkcs7_decrypt_error.phpt | 4 +- ext/openssl/tests/openssl_pkey_new_error.phpt | 12 +- .../tests/openssl_private_decrypt_basic.phpt | 4 +- .../tests/openssl_private_decrypt_digest.phpt | 4 +- .../tests/openssl_public_decrypt_basic.phpt | 8 +- .../openssl_random_pseudo_bytes_error.phpt | 4 +- ext/openssl/tests/openssl_seal_basic.phpt | 8 +- .../tests/openssl_x509_export_basic.phpt | 4 +- .../openssl_x509_export_to_file_basic.phpt | 4 +- .../tests/openssl_x509_read_basic.phpt | 8 +- .../php_openssl_pkey_from_zval_leak.phpt | 4 +- .../session_resumption_get_cb_no_ticket.phpt | 1 - ...ion_resumption_invalid_session_import.phpt | 4 +- .../tests/tls_psk_callback_not_callable.phpt | 1 - .../tests/tls_psk_client_callback_null.phpt | 1 - .../tests/tls_psk_client_callback_throws.phpt | 1 - .../tests/tls_psk_client_no_identity.phpt | 1 - ext/openssl/tests/tls_psk_mismatch.phpt | 1 - .../tests/tls_psk_tls13_unknown_identity.phpt | 1 - 40 files changed, 150 insertions(+), 161 deletions(-) diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt index 6064380c8bca..49e289ddf266 100644 --- a/ext/openssl/tests/bug38261.phpt +++ b/ext/openssl/tests/bug38261.phpt @@ -17,13 +17,13 @@ var_dump(openssl_x509_parse("foo")); try { var_dump(openssl_x509_parse($t)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { openssl_x509_parse([]); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(openssl_x509_parse($cert)); @@ -31,13 +31,13 @@ var_dump(openssl_x509_parse($cert)); try { openssl_x509_parse(new stdClass); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + 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..24f652a1c685 100644 --- a/ext/openssl/tests/bug60632.phpt +++ b/ext/openssl/tests/bug60632.phpt @@ -21,8 +21,8 @@ $ekeys = array(); try { $result = openssl_seal('test phrase', $encrypted, $ekeys, array($pubkey), 'AES-256-CBC'); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --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..46d50acd4d9f 100644 --- a/ext/openssl/tests/bug68912.phpt +++ b/ext/openssl/tests/bug68912.phpt @@ -16,8 +16,8 @@ $var3=3; try { openssl_spki_new($var1, $var2, $var3); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + 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..6bcbda3b07f4 100644 --- a/ext/openssl/tests/bug71475.phpt +++ b/ext/openssl/tests/bug71475.phpt @@ -8,10 +8,10 @@ $_ = str_repeat("A", 512); try { openssl_seal($_, $_, $_, array_fill(0,64,0)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + 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..938b449670d4 100644 --- a/ext/openssl/tests/bug81713.phpt +++ b/ext/openssl/tests/bug81713.phpt @@ -130,7 +130,7 @@ foreach ($tests as $test) { var_dump($key); } catch (ValueError $e) { - echo $e->getMessage() . PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } } ?> @@ -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..78a0df6825dc 100644 --- a/ext/openssl/tests/memory_leak_x509_store.phpt +++ b/ext/openssl/tests/memory_leak_x509_store.phpt @@ -14,9 +14,9 @@ class MyStringable{ try { openssl_pkcs7_verify("does not matter", 0, "does not matter", [new MyStringable]); } catch (Error $e) { - echo $e->getMessage(), "\n"; + 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..8924fa2af675 100644 --- a/ext/openssl/tests/openssl_cipher_iv_length_error.phpt +++ b/ext/openssl/tests/openssl_cipher_iv_length_error.phpt @@ -10,12 +10,11 @@ var_dump(openssl_cipher_iv_length('unknown')); try { var_dump(openssl_cipher_iv_length('')); } catch (ValueError $e) { - echo $e->getMessage() . "\n"; + 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..92aca289ad3e 100644 --- a/ext/openssl/tests/openssl_cipher_key_length_error.phpt +++ b/ext/openssl/tests/openssl_cipher_key_length_error.phpt @@ -10,12 +10,11 @@ var_dump(openssl_cipher_key_length('unknown')); try { var_dump(openssl_cipher_key_length('')); } catch (ValueError $e) { - echo $e->getMessage() . "\n"; + 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..28ff09357a25 100644 --- a/ext/openssl/tests/openssl_cms_decrypt_error.phpt +++ b/ext/openssl/tests/openssl_cms_decrypt_error.phpt @@ -18,7 +18,7 @@ $d = new stdclass; try { var_dump(openssl_cms_decrypt($a, $b, $c, $d)); } catch (Error $e) { - echo $e->getMessage(), "\n"; + 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..1e5fa55fb298 100644 --- a/ext/openssl/tests/openssl_csr_export_basic.phpt +++ b/ext/openssl/tests/openssl_csr_export_basic.phpt @@ -34,12 +34,12 @@ var_dump(openssl_csr_export($csr, $output)); try { var_dump(openssl_csr_export($wrong, $output)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { var_dump(openssl_csr_export($privkey, $output)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + 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..b475cc416e11 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt @@ -46,7 +46,7 @@ var_dump(openssl_csr_export_to_file($wrong, $csrfile)); try { openssl_csr_export_to_file($dh, $csrfile); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + 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..7ca0c599d65a 100644 --- a/ext/openssl/tests/openssl_csr_new_basic.phpt +++ b/ext/openssl/tests/openssl_csr_new_basic.phpt @@ -13,7 +13,7 @@ try { var_dump(openssl_csr_new(array(), $a, $conf, array())); var_dump($keyFailed); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } // 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..e99cdc024573 100644 --- a/ext/openssl/tests/openssl_csr_sign_basic.phpt +++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt @@ -45,19 +45,19 @@ var_dump(openssl_csr_sign($wrong, null, $privkey, 365)); try { openssl_csr_sign(array(), null, $privkey, 365); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(openssl_csr_sign($csr, array(), $privkey, 365)); } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { var_dump(openssl_csr_sign($csr, null, array(), 365)); } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; + 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..e35efdd8e045 100644 --- a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt @@ -33,7 +33,7 @@ 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"; + 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 f53e9753613e..bb9fafeea9c7 100644 --- a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt @@ -33,7 +33,7 @@ var_dump(openssl_pkcs12_export_to_file($invalid_path, $pkcsfile, $invalid_path, try { var_dump(openssl_pkcs12_export_to_file($priv_res, $pkcsfile, $cert_res, $pass)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + 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_pkcs12_read_array_init.phpt b/ext/openssl/tests/openssl_pkcs12_read_array_init.phpt index b57cd32b686a..f62d7d3e348c 100644 --- a/ext/openssl/tests/openssl_pkcs12_read_array_init.phpt +++ b/ext/openssl/tests/openssl_pkcs12_read_array_init.phpt @@ -16,7 +16,7 @@ $typed = new Typed; try { openssl_pkcs12_read($cert_store, $typed->foo, "csos"); } catch (TypeError $e) { - echo $e::class, ": ", $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- diff --git a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt index 480e662e4145..1069a9e4e797 100644 --- a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt +++ b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt @@ -18,7 +18,7 @@ $d = new stdclass; try { var_dump(openssl_pkcs7_decrypt($a, $b, $c, $d)); } catch (Error $e) { - echo $e->getMessage(), "\n"; + 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..5a09a055372b 100644 --- a/ext/openssl/tests/openssl_pkey_new_error.phpt +++ b/ext/openssl/tests/openssl_pkey_new_error.phpt @@ -14,20 +14,20 @@ $dh = array("dh" => array()); try { openssl_pkey_get_details(openssl_pkey_new($rsa)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { openssl_pkey_get_details(openssl_pkey_new($dsa)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { openssl_pkey_get_details(openssl_pkey_new($dh)); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + 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..fe557d17cfda 100644 --- a/ext/openssl/tests/openssl_private_decrypt_basic.phpt +++ b/ext/openssl/tests/openssl_private_decrypt_basic.phpt @@ -21,7 +21,7 @@ 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; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } 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..26120971a201 100644 --- a/ext/openssl/tests/openssl_private_decrypt_digest.phpt +++ b/ext/openssl/tests/openssl_private_decrypt_digest.phpt @@ -34,7 +34,7 @@ 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()); + 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..f6c9c04d9af6 100644 --- a/ext/openssl/tests/openssl_public_decrypt_basic.phpt +++ b/ext/openssl/tests/openssl_public_decrypt_basic.phpt @@ -21,14 +21,14 @@ try { var_dump(openssl_public_decrypt($encrypted, $output4, array())); var_dump($output4); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } try { var_dump(openssl_public_decrypt($encrypted, $output5, array($pubkey))); var_dump($output5); } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } 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..6bfd8d89de6a 100644 --- a/ext/openssl/tests/openssl_random_pseudo_bytes_error.phpt +++ b/ext/openssl/tests/openssl_random_pseudo_bytes_error.phpt @@ -7,8 +7,8 @@ openssl try { openssl_random_pseudo_bytes(0); } catch (Error $e) { - echo $e->getMessage().PHP_EOL; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } ?> --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..2531f008fc6d 100644 --- a/ext/openssl/tests/openssl_seal_basic.phpt +++ b/ext/openssl/tests/openssl_seal_basic.phpt @@ -16,7 +16,7 @@ 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; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } // tests with cert @@ -31,7 +31,7 @@ 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; + echo $e::class, ': ', $e->getMessage(), PHP_EOL; } 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..124cd6d277bd 100644 --- a/ext/openssl/tests/openssl_x509_export_basic.phpt +++ b/ext/openssl/tests/openssl_x509_export_basic.phpt @@ -20,7 +20,7 @@ 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"; + 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..6c72e23b6e60 100644 --- a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt @@ -20,7 +20,7 @@ var_dump(openssl_x509_export_to_file($d, $outfilename)); // read cert from a res try { openssl_x509_export_to_file($e, $outfilename); // read an array, fails } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + 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..5ec5f7de2d10 100644 --- a/ext/openssl/tests/openssl_x509_read_basic.phpt +++ b/ext/openssl/tests/openssl_x509_read_basic.phpt @@ -22,13 +22,13 @@ 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"; + echo $exception::class, ': ', $exception->getMessage(), "\n"; } try { openssl_x509_read($f); // read an array with the filename } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; + 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..5fbda8ee488f 100644 --- a/ext/openssl/tests/php_openssl_pkey_from_zval_leak.phpt +++ b/ext/openssl/tests/php_openssl_pkey_from_zval_leak.phpt @@ -15,9 +15,9 @@ $key = ["", new StrFail]; try { openssl_pkey_export_to_file($key, "doesnotmatter"); } catch (Error $e) { - echo $e->getMessage(), "\n"; + 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 a9c5b65f2051..0a8b846928e3 100644 --- a/ext/openssl/tests/session_resumption_invalid_session_import.phpt +++ b/ext/openssl/tests/session_resumption_invalid_session_import.phpt @@ -12,7 +12,7 @@ if (!function_exists("proc_open")) die("skip no proc_open"); try { Openssl\Session::import('invalid'); } catch (Openssl\OpensslException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --CLEAN-- @@ -20,4 +20,4 @@ try { @unlink(__DIR__ . DIRECTORY_SEPARATOR . 'session_cache_disabled.pem.tmp'); ?> --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) -