1--TEST-- 2Bug #74341 (openssl_x509_parse fails to parse ASN.1 UTCTime without seconds) 3--EXTENSIONS-- 4openssl 5--SKIPIF-- 6<?php 7if (OPENSSL_VERSION_NUMBER >= 0x30300000) die('skip For OpenSSL < 3.3'); 8?> 9--FILE-- 10<?php 11 12$pem_cert = ' 13-----BEGIN CERTIFICATE----- 14MIIGFDCCBPygAwIBAgIDKCHVMA0GCSqGSIb3DQEBBQUAMIHcMQswCQYDVQQGEwJV 15UzEQMA4GA1UECBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTElMCMGA1UE 16ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjE5MDcGA1UECxMwaHR0cDov 17L2NlcnRpZmljYXRlcy5zdGFyZmllbGR0ZWNoLmNvbS9yZXBvc2l0b3J5MTEwLwYD 18VQQDEyhTdGFyZmllbGQgU2VjdXJlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MREw 19DwYDVQQFEwgxMDY4ODQzNTAcFwsxNDAxMDcwMDAwWhcNMTYwNDAxMDcwMDAwWjCB 206zETMBEGCysGAQQBgjc8AgEDEwJVUzEYMBYGCysGAQQBgjc8AgECEwdBcml6b25h 21MR0wGwYDVQQPExRQcml2YXRlIE9yZ2FuaXphdGlvbjEUMBIGA1UEBRMLUi0xNzI0 22NzQxLTYxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpT 23Y290dHNkYWxlMSQwIgYDVQQKExtTdGFyZmllbGQgVGVjaG5vbG9naWVzLCBMTEMx 24KzApBgNVBAMTInZhbGlkLnNmaS5jYXRlc3Quc3RhcmZpZWxkdGVjaC5jb20wggEi 25MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCt1LHQOza9tkKxwGL+/yKi/Fe5 26HM0sjvcM4ic1XVrvpewa4P/04IzGSjIGO3CXaSArxQMSzsTt2dcO9tSJ1Zk8c9NZ 27XM8eVqx92iTMEf9OQcubWpzW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brBgaAzkE8jDlExtd7c4pE7JF40jxmvDwjZ 44HwpyNDULreGtFBij7JcWJCfihM3uetqrao0kOoeih1PQyJXtz2RldhFYs6Jdk3IL 45Yv+84t5UMO+aS9nVBXIcbgaGjIMZjHDgR/tE9FKFB66k8UTDzAwwEs38VV24zx6h 46lOzTF7xAUxmPUnNb2teatMf2Rmj0fs+d 47-----END CERTIFICATE----- 48'; 49 50$parsed_cert = openssl_x509_parse($pem_cert); 51var_dump($parsed_cert['validFrom_time_t']); 52var_dump($parsed_cert['validTo_time_t']); 53?> 54--EXPECT-- 55int(1389052800) 56int(1459494000) 57