Your message dated Mon, 14 Jan 2013 09:40:00 +0100
with message-id 
<CALjhHG_JpyUPsUN6iD-_qXj_5jxJa52WaAVT5gfU=t8roxx...@mail.gmail.com>
and subject line Re: [php-maint] Bug#698109: PHP5 integer error in json_decode()
has caused the Debian Bug report #698109,
regarding PHP5 integer error in json_decode()
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
698109: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698109
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: php5
Version: 5.2.6.dfsg.1-1+lenny9

I realise this is an old version, but on looking through the bug
reports and changelogs I see no mention of any similar bugs or actions
to fix them, so I consider it possible that the bug still exists.

json_decode() does not always correctly decode integer values on large
integers such as twitter status IDs. It subtracts 1, or sometimes 2,
from the decoded value. This does not always happen and appears to be
unpredictable.

This is not an overflow error as the integers concerned, though large,
are still below the limit for the 64-bit system on which I discovered
the bug.

Here are some examples of incorrect output, generated using
command-line PHP with sample truncated twitter JSON strings:

Subtracting 1:

<?php
$j='[{"created_at":"Mon Jan 14 01:01:28 +0000 
2013","id":190624640131428353,"id_str":"190624640131428353"}]';
$a=190624640131428353;
$b='190624640131428353';
$c=intval($a);
$d=json_decode($j, true);
$e=json_decode($j, false);
var_dump($a);
var_dump($b);
var_dump($c);
var_dump($d);
var_dump($e);
?>
int(190624640131428353)
string(18) "190624640131428353"
int(190624640131428353)
array(1) {
  [0]=>
  array(3) {
    ["created_at"]=>
    string(30) "Mon Jan 14 01:01:28 +0000 2013"
    ["id"]=>
    int(190624640131428352)
    ["id_str"]=>
    string(18) "190624640131428353"
  }
}
array(1) {
  [0]=>
  object(stdClass)#1 (3) {
    ["created_at"]=>
    string(30) "Mon Jan 14 01:01:28 +0000 2013"
    ["id"]=>
    int(190624640131428352)
    ["id_str"]=>
    string(18) "190624640131428353"
  }
}


Subtracting 2:

<?php
$j='[{"created_at":"Mon Jan 14 01:01:28 +0000 
2013","id":190624590269513730,"id_str":"190624590269513730"}]';
$a=190624590269513730;
$b='190624590269513730';
$c=intval($a);
$d=json_decode($j, true);
$e=json_decode($j, false);
var_dump($a);
var_dump($b);
var_dump($c);
var_dump($d);
var_dump($e);
?>
int(190624590269513730)
string(18) "190624590269513730"
int(190624590269513730)
array(1) {
  [0]=>
  array(3) {
    ["created_at"]=>
    string(30) "Mon Jan 14 01:01:28 +0000 2013"
    ["id"]=>
    int(190624590269513728)
    ["id_str"]=>
    string(18) "190624590269513730"
  }
}
array(1) {
  [0]=>
  object(stdClass)#1 (3) {
    ["created_at"]=>
    string(30) "Mon Jan 14 01:01:28 +0000 2013"
    ["id"]=>
    int(190624590269513728)
    ["id_str"]=>
    string(18) "190624590269513730"
  }
}
                                                
By comparison, the (larger) integer 190694799109677056 is handled correctly.

-- 
Pigeon

Be kind to pigeons        - -        Pigeon's Nest: http://pigeonsnest.co.uk/
                          - -      Lucy Pinder TV: http://www.lucy-pinder.tv/
GPG key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x21C61F7F

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Version: 5.3.3-7+squeeze14

Hi Pigeon,

this bug don't manifest in squeeze, thus marking it as fixed.  It
works correctly on 64-bit. On 32-bit, it converts the number to float
to prevent the overfloat.

Ondrej

On Mon, Jan 14, 2013 at 7:59 AM, Pigeon <[email protected]> wrote:
> Package: php5
> Version: 5.2.6.dfsg.1-1+lenny9
>
> I realise this is an old version, but on looking through the bug
> reports and changelogs I see no mention of any similar bugs or actions
> to fix them, so I consider it possible that the bug still exists.
>
> json_decode() does not always correctly decode integer values on large
> integers such as twitter status IDs. It subtracts 1, or sometimes 2,
> from the decoded value. This does not always happen and appears to be
> unpredictable.
>
> This is not an overflow error as the integers concerned, though large,
> are still below the limit for the 64-bit system on which I discovered
> the bug.
>
> Here are some examples of incorrect output, generated using
> command-line PHP with sample truncated twitter JSON strings:
>
> Subtracting 1:
>
> <?php
> $j='[{"created_at":"Mon Jan 14 01:01:28 +0000 
> 2013","id":190624640131428353,"id_str":"190624640131428353"}]';
> $a=190624640131428353;
> $b='190624640131428353';
> $c=intval($a);
> $d=json_decode($j, true);
> $e=json_decode($j, false);
> var_dump($a);
> var_dump($b);
> var_dump($c);
> var_dump($d);
> var_dump($e);
> ?>
> int(190624640131428353)
> string(18) "190624640131428353"
> int(190624640131428353)
> array(1) {
>   [0]=>
>   array(3) {
>     ["created_at"]=>
>     string(30) "Mon Jan 14 01:01:28 +0000 2013"
>     ["id"]=>
>     int(190624640131428352)
>     ["id_str"]=>
>     string(18) "190624640131428353"
>   }
> }
> array(1) {
>   [0]=>
>   object(stdClass)#1 (3) {
>     ["created_at"]=>
>     string(30) "Mon Jan 14 01:01:28 +0000 2013"
>     ["id"]=>
>     int(190624640131428352)
>     ["id_str"]=>
>     string(18) "190624640131428353"
>   }
> }
>
>
> Subtracting 2:
>
> <?php
> $j='[{"created_at":"Mon Jan 14 01:01:28 +0000 
> 2013","id":190624590269513730,"id_str":"190624590269513730"}]';
> $a=190624590269513730;
> $b='190624590269513730';
> $c=intval($a);
> $d=json_decode($j, true);
> $e=json_decode($j, false);
> var_dump($a);
> var_dump($b);
> var_dump($c);
> var_dump($d);
> var_dump($e);
> ?>
> int(190624590269513730)
> string(18) "190624590269513730"
> int(190624590269513730)
> array(1) {
>   [0]=>
>   array(3) {
>     ["created_at"]=>
>     string(30) "Mon Jan 14 01:01:28 +0000 2013"
>     ["id"]=>
>     int(190624590269513728)
>     ["id_str"]=>
>     string(18) "190624590269513730"
>   }
> }
> array(1) {
>   [0]=>
>   object(stdClass)#1 (3) {
>     ["created_at"]=>
>     string(30) "Mon Jan 14 01:01:28 +0000 2013"
>     ["id"]=>
>     int(190624590269513728)
>     ["id_str"]=>
>     string(18) "190624590269513730"
>   }
> }
>
> By comparison, the (larger) integer 190694799109677056 is handled correctly.
>
> --
> Pigeon
>
> Be kind to pigeons        - -        Pigeon's Nest: http://pigeonsnest.co.uk/
>                           - -      Lucy Pinder TV: http://www.lucy-pinder.tv/
> GPG key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x21C61F7F
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFQ86y/UxADjyHGH38RAkgcAJ9d5t54rzyDQ79AwijhNsn9k+mXjACfaNMF
> msqBQWl0H/k8pd9WVChrYzY=
> =goVg
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> pkg-php-maint mailing list
> [email protected]
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-php-maint



-- 
Ondřej Surý <[email protected]>

--- End Message ---

Reply via email to