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