xref: /PHP-5.4/ext/openssl/tests/bug64802.phpt (revision 633f898f)
1--TEST--
2Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) die("skip");
6if (!defined(OPENSSL_KEYTYPE_EC)) die("skip no EC available);
7?>
8--FILE--
9<?php
10$cert = file_get_contents(__DIR__.'/bug64802.pem');
11$r = openssl_x509_parse($cert,$use_short_names=true);
12sort($r['subject']);
13var_dump( $r['subject'] );
14?>
15--EXPECTF--
16array(11) {
17  [0]=>
18  string(14) "1550 Bryant st"
19  [1]=>
20  string(5) "94103"
21  [2]=>
22  string(7) "4586007"
23  [3]=>
24  string(2) "CA"
25  [4]=>
26  string(26) "COMODO EV Multi-Domain SSL"
27  [5]=>
28  string(20) "Private Organization"
29  [6]=>
30  string(10) "Rdio, Inc."
31  [7]=>
32  string(13) "San Francisco"
33  [8]=>
34  string(2) "US"
35  [9]=>
36  array(2) {
37    [0]=>
38    string(2) "US"
39    [1]=>
40    string(8) "Delaware"
41  }
42  [10]=>
43  array(6) {
44    [0]=>
45    string(9) "www.rd.io"
46    [1]=>
47    string(8) "rdio.com"
48    [2]=>
49    string(5) "rd.io"
50    [3]=>
51    string(12) "api.rdio.com"
52    [4]=>
53    string(9) "api.rd.io"
54    [5]=>
55    string(12) "www.rdio.com"
56  }
57}
58