From:             mark at zedwood dot com
Operating system: Ubuntu Linux
PHP version:      5.4.15
Package:          OpenSSL related
Bug Type:         Bug
Bug description:openssl_x509_parse fails to parse subject properly in some cases

Description:
------------
When the subject of the certificate has multiple CN (common name) values in
the subject, openssl_x509_parse seems to work, but in this case it fails to
parse the rest of the subject as well as additional CN values.

Here is the subject of the cert triggering the failure
cat cert.pem |openssl x509 -noout -text |grep Subject:
Subject: CN=www.rd.io, CN=rdio.com, CN=rd.io, CN=api.rdio.com,
CN=api.rd.io/serialNumber=4586007/1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/businessCategory=Private
Organization, C=US/postalCode=94103, ST=CA, L=San Francisco/street=1550
Bryant st, O=Rdio, Inc., OU=COMODO EV Multi-Domain SSL, CN=www.rdio.com

The cert.pem I used can be found in the embedded php script:
http://pastebin.com/dppuUWVq

Test script:
---------------
http://pastebin.com/dppuUWVq

Expected result:
----------------
Array
(
    [CN] => Array(
        [0] => www.rdio.com
        [1] => api.rd.io
        [2] => api.rdio.com
        [3] => rd.io
        [4] => rdio.com
        [5] => www.rd.io
    )
    [OU] => COMODO EV Multi-Domain SSL
    [O] => Rdio, Inc
    [street] => 1550 Bryant st
    [L] => San Francisco
    [ST] => CA
    [postalCode] => 94103
    [C] => US
    [businessCategory] => Private Organization
    [1.3.6.1.4.1.311.60.2.1.2] => Delaware
    [1.3.6.1.4.1.311.60.2.1.3] => US
    [serialNumber] => 4586007
)

Actual result:
--------------
Array
(
    [CN] => Array
        (
            [0] => www.rd.io
            [1] => rdio.com
            [2] => rd.io
            [3] => api.rdio.com
            [4] => api.rd.io
            [5] => www.rdio.com
        )
)


-- 
Edit bug report at https://bugs.php.net/bug.php?id=64802&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64802&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64802&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64802&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64802&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64802&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64802&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64802&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64802&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64802&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64802&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64802&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64802&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64802&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64802&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64802&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64802&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64802&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64802&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64802&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64802&r=mysqlcfg

Reply via email to