Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ext/openssl/tests/bug38261.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ 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));

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
4 changes: 2 additions & 2 deletions ext/openssl/tests/bug60632.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/openssl/tests/bug68912.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/openssl/tests/bug71475.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
152 changes: 76 additions & 76 deletions ext/openssl/tests/bug81713.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
?>
Expand All @@ -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
1 change: 0 additions & 1 deletion ext/openssl/tests/gh22081.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ ok 1
ok 2
ok 3
ok 4

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and following) remove duplicated empty lines at the file end.

4 changes: 2 additions & 2 deletions ext/openssl/tests/memory_leak_x509_store.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions ext/openssl/tests/openssl_cipher_iv_length_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions ext/openssl/tests/openssl_cipher_key_length_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions ext/openssl/tests/openssl_cms_decrypt_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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"
Expand Down
1 change: 0 additions & 1 deletion ext/openssl/tests/openssl_cms_encrypt_der.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ bool(true)
Now is the winter of our discontent.
true
true

6 changes: 3 additions & 3 deletions ext/openssl/tests/openssl_csr_export_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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));
?>
Expand All @@ -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)
Loading
Loading