xref: /PHP-8.0/ext/openssl/tests/bug52093.phpt (revision 334387bb)
1--TEST--
2Bug #52093 (openssl_csr_sign truncates $serial)
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) print "skip";
6if (PHP_INT_SIZE !== 8) die("skip this test is for 64bit platforms only");
7?>
8--FILE--
9<?php
10$dn = array(
11    "countryName" => "BR",
12    "stateOrProvinceName" => "Rio Grande do Sul",
13    "localityName" => "Porto Alegre",
14    "commonName" => "Henrique do N. Angelo",
15    "emailAddress" => "hnangelo@php.net"
16);
17
18$privkey = openssl_pkey_new();
19$csr = openssl_csr_new($dn, $privkey);
20$cert = openssl_csr_sign($csr, null, $privkey, 365, [], PHP_INT_MAX);
21var_dump(openssl_x509_parse($cert)['serialNumber']);
22?>
23--EXPECT--
24string(19) "9223372036854775807"
25