xref: /PHP-7.4/ext/simplexml/tests/bug54973.phpt (revision c6c9e71a)
1--TEST--
2Bug #54973: SimpleXML casts integers wrong
3--SKIPIF--
4<?php if (!extension_loaded('simplexml')) die('skip simplexml extension not loaded'); ?>
5--FILE--
6<?php
7$xml = simplexml_load_string("<xml><number>9223372036854775808</number></xml>");
8
9var_dump($xml->number);
10
11$int = $xml->number / 1024 / 1024 / 1024;
12var_dump($int);
13
14$double = (double) $xml->number / 1024 / 1024 / 1024;
15var_dump($double);
16?>
17--EXPECT--
18object(SimpleXMLElement)#2 (1) {
19  [0]=>
20  string(19) "9223372036854775808"
21}
22float(8589934592)
23float(8589934592)
24