diff options
author | Gustavo André dos Santos Lopes <cataphract@php.net> | 2011-09-12 20:05:07 +0000 |
---|---|---|
committer | Gustavo André dos Santos Lopes <cataphract@php.net> | 2011-09-12 20:05:07 +0000 |
commit | d7c7fe3587b95b65317d5ccf5a2837ebda0030b8 (patch) | |
tree | f73005fecbbe5d82d1409cf608ae1bf7e4b518bc | |
parent | ba04ba9c8293c740ea3f536e80dc37b7118e181b (diff) | |
download | php-git-d7c7fe3587b95b65317d5ccf5a2837ebda0030b8.tar.gz |
- Test for bug #55646.
-rw-r--r-- | ext/openssl/tests/bug55646.phpt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/openssl/tests/bug55646.phpt b/ext/openssl/tests/bug55646.phpt new file mode 100644 index 0000000000..b7118fc04d --- /dev/null +++ b/ext/openssl/tests/bug55646.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #55646: textual input in openssl_csr_new() is not expected in UTF-8 +--SKIPIF-- +<?php +if (!function_exists('openssl_csr_new')) + die('skip no openssl extension'); +--FILE-- +<?php +function stringAsHex($string){$unpacked = unpack("H*", $string);return implode(" ", str_split($unpacked[1],2));} + +$config = array("digest_alg" => "sha1","x509_extensions" => "v3_ca","req_extensions" => "v3_req","private_key_bits" => 2048,"private_key_type" => OPENSSL_KEYTYPE_RSA,"encrypt_key" => false,); +$csr_info = array( + "countryName" => "US", + "stateOrProvinceName" => "Utah", + "localityName" => "Lindon", + "organizationName" => "Chinese", + "organizationalUnitName" => "IT \xe4\xba\x92", + "commonName" => "www.example.com",); +$private = openssl_pkey_new($config); +$csr_res = openssl_csr_new($csr_info, $private); +openssl_csr_export($csr_res, $csr); +$output = openssl_csr_get_subject($csr); + +echo "A: ".$csr_info["organizationalUnitName"]."\n"; +echo "B: ".stringAsHex($csr_info["organizationalUnitName"])."\n"; +echo "C: ".$output['OU']."\n"; +echo "D: ".stringAsHex($output['OU'])."\n"; +--EXPECT-- +A: IT 互 +B: 49 54 20 e4 ba 92 +C: IT 互 +D: 49 54 20 e4 ba 92 |