bug52093.phpt 735 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Bug #52093 (openssl_csr_sign truncates $serial)
  3. --EXTENSIONS--
  4. openssl
  5. --SKIPIF--
  6. <?php
  7. if (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);
  22. var_dump(openssl_x509_parse($cert)['serialNumber']);
  23. ?>
  24. --EXPECT--
  25. string(19) "9223372036854775807"