php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10133 Some values returned by gmp_strval are null-terminated
Submitted: 2001-04-03 07:13 UTC Modified: 2002-02-10 18:16 UTC
From: chr at tv2i dot dk Assigned:
Status: Closed Package: Math related
PHP Version: 4.0.4pl1 OS: Linux 2.2.16-3
Private report: No CVE-ID: None
 [2001-04-03 07:13 UTC] chr at tv2i dot dk
Some values returned by gmp_strval are padded with an additional \0 byte.

The code

  for ($i = 0; $i < 20; $i++) {
      $n = gmp_init($i);
      $ns = gmp_strval($n);
      print ord(substr($ns, -1)) . ' ';
  }

outputs

  48 49 50 51 52 53 54 55 0 0 48 49 50 51 52 53 54 55 56 57 

where I would expect

  48 49 50 51 52 53 54 55 56 57 48 49 50 51 52 53 54 55 56 57


This behavior is reproducible.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-29 06:42 UTC] jmoore@php.net
reclassify
 [2002-02-10 18:16 UTC] elixer@php.net
This bug has been fixed in CVS.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 03:03:16 2021 UTC