Skip to content

Commit 2854f32

Browse files
committed
Fix patch to work against PHP7
This also updates the testcases so they now return correct data with the extra return value.
1 parent 73bae6b commit 2854f32

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ext/openssl/openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,7 @@ PHP_FUNCTION(openssl_x509_parse)
20232023
if (!hexserial) {
20242024
RETURN_FALSE;
20252025
}
2026-
add_assoc_string(return_value, "serialNumberHex", hexserial, 1);
2026+
add_assoc_string(return_value, "serialNumberHex", hexserial);
20272027
OPENSSL_free(hexserial);
20282028

20292029
add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert));

ext/openssl/tests/openssl_x509_parse_basic.phpt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var_dump(openssl_x509_parse($cert));
1212
var_dump(openssl_x509_parse($cert, false));
1313
?>
1414
--EXPECTF--
15-
array(15) {
15+
array(16) {
1616
["name"]=>
1717
string(96) "/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net"
1818
["subject"]=>
@@ -47,6 +47,8 @@ array(15) {
4747
int(2)
4848
["serialNumber"]=>
4949
string(20) "12593567369101004962"
50+
["serialNumberHex"]=>
51+
string(16) "AEC556CC723750A2"
5052
["validFrom"]=>
5153
string(13) "080630102843Z"
5254
["validTo"]=>
@@ -158,7 +160,7 @@ serial:AE:C5:56:CC:72:37:50:A2
158160
string(7) "CA:TRUE"
159161
}
160162
}
161-
array(15) {
163+
array(16) {
162164
["name"]=>
163165
string(96) "/C=BR/ST=Rio Grande do Sul/L=Porto Alegre/CN=Henrique do N. Angelo/emailAddress=hnangelo@php.net"
164166
["subject"]=>
@@ -193,6 +195,8 @@ array(15) {
193195
int(2)
194196
["serialNumber"]=>
195197
string(20) "12593567369101004962"
198+
["serialNumberHex"]=>
199+
string(16) "AEC556CC723750A2"
196200
["validFrom"]=>
197201
string(13) "080630102843Z"
198202
["validTo"]=>

0 commit comments

Comments
 (0)