Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions Zend/tests/exceptions/bug50383.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ function thrower2() {
try {
thrower();
} catch(Throwable $e) {
echo $e::class, ': ', $e->getMessage();
echo $e::class, ': ', $e->getMessage(), "\n";
print_r($e->getTrace());
}

try {
thrower2();
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage();
echo $e::class, ': ', $e->getMessage(), "\n";
print_r($e->getTrace());
}

?>
--EXPECTF--
Exception: Missing static method 'ThrowException'

Array
(
[0] => Array
Expand Down Expand Up @@ -70,6 +71,7 @@ Array

)
Exception: Missing method 'foo'

Array
(
[0] => Array
Expand Down
16 changes: 8 additions & 8 deletions ext/openssl/tests/bug38261.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ var_dump(openssl_x509_parse("foo"));

try {
var_dump(openssl_x509_parse($t));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

try {
openssl_x509_parse([]);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

var_dump(openssl_x509_parse($cert));

try {
openssl_x509_parse(new stdClass);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
bool(false)
bool(false)
openssl_x509_parse(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array given
TypeError: openssl_x509_parse(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, array given
bool(false)
openssl_x509_parse(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, stdClass given
TypeError: openssl_x509_parse(): Argument #1 ($certificate) must be of type OpenSSLCertificate|string, stdClass given
6 changes: 3 additions & 3 deletions ext/openssl/tests/bug60632.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ $ekeys = array();

try {
$result = openssl_seal('test phrase', $encrypted, $ekeys, array($pubkey), 'AES-256-CBC');
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
} catch (\Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
openssl_seal(): Argument #6 ($iv) cannot be null for the chosen cipher algorithm
ValueError: openssl_seal(): Argument #6 ($iv) cannot be null for the chosen cipher algorithm
6 changes: 3 additions & 3 deletions ext/openssl/tests/bug68912.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ $var3=3;

try {
openssl_spki_new($var1, $var2, $var3);
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
openssl_spki_new(): Argument #1 ($private_key) must be of type OpenSSLAsymmetricKey, resource given
TypeError: openssl_spki_new(): Argument #1 ($private_key) must be of type OpenSSLAsymmetricKey, resource given
6 changes: 3 additions & 3 deletions ext/openssl/tests/bug71475.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ openssl
$_ = str_repeat("A", 512);
try {
openssl_seal($_, $_, $_, array_fill(0,64,0));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
DONE
--EXPECT--
openssl_seal() expects at least 5 arguments, 4 given
ArgumentCountError: openssl_seal() expects at least 5 arguments, 4 given
DONE
154 changes: 77 additions & 77 deletions ext/openssl/tests/bug81713.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ foreach ($tests as $test) {
$key = call_user_func_array($test[0], array_slice($test, 1));
var_dump($key);
}
catch (ValueError $e) {
echo $e->getMessage() . PHP_EOL;
catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
}
?>
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

6 changes: 3 additions & 3 deletions ext/openssl/tests/memory_leak_x509_store.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class MyStringable{

try {
openssl_pkcs7_verify("does not matter", 0, "does not matter", [new MyStringable]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
stop
Error: stop
7 changes: 3 additions & 4 deletions ext/openssl/tests/openssl_cipher_iv_length_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ var_dump(openssl_cipher_iv_length('unknown'));

try {
var_dump(openssl_cipher_iv_length(''));
} catch (ValueError $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECTF--

Warning: openssl_cipher_iv_length(): Unknown cipher algorithm in %s on line %d
bool(false)
openssl_cipher_iv_length(): Argument #1 ($cipher_algo) must not be empty
ValueError: openssl_cipher_iv_length(): Argument #1 ($cipher_algo) must not be empty
7 changes: 3 additions & 4 deletions ext/openssl/tests/openssl_cipher_key_length_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ var_dump(openssl_cipher_key_length('unknown'));

try {
var_dump(openssl_cipher_key_length(''));
} catch (ValueError $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECTF--

Warning: openssl_cipher_key_length(): Unknown cipher algorithm in %s on line %d
bool(false)
openssl_cipher_key_length(): Argument #1 ($cipher_algo) must not be empty
ValueError: openssl_cipher_key_length(): Argument #1 ($cipher_algo) must not be empty
6 changes: 3 additions & 3 deletions ext/openssl/tests/openssl_cms_decrypt_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ $d = new stdclass;

try {
var_dump(openssl_cms_decrypt($a, $b, $c, $d));
} catch (Error $e) {
echo $e->getMessage(), "\n";
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($c);

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
Loading
Loading