Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #54973: SimpleXML casts integers wrong --EXTENSIONS-- simplexml --FILE-- <?ph..

Decoded Output download

--TEST--
Bug #54973: SimpleXML casts integers wrong
--EXTENSIONS--
simplexml
--FILE--
<?php
$xml = simplexml_load_string("<xml><number>9223372036854775808</number></xml>");

var_dump($xml->number);

$int = $xml->number / 1024 / 1024 / 1024;
var_dump($int);

$double = (double) $xml->number / 1024 / 1024 / 1024;
var_dump($double);
?>
--EXPECT--
object(SimpleXMLElement)#2 (1) {
  [0]=>
  string(19) "9223372036854775808"
}
float(8589934592)
float(8589934592)

Did this file decode correctly?

Original Code

--TEST--
Bug #54973: SimpleXML casts integers wrong
--EXTENSIONS--
simplexml
--FILE--
<?php
$xml = simplexml_load_string("<xml><number>9223372036854775808</number></xml>");

var_dump($xml->number);

$int = $xml->number / 1024 / 1024 / 1024;
var_dump($int);

$double = (double) $xml->number / 1024 / 1024 / 1024;
var_dump($double);
?>
--EXPECT--
object(SimpleXMLElement)#2 (1) {
  [0]=>
  string(19) "9223372036854775808"
}
float(8589934592)
float(8589934592)

Function Calls

simplexml_load_string 1

Variables

None

Stats

MD5 3ba10ea382e70f5ac8e2f3bb71bd4c36
Eval Count 0
Decode Time 83 ms