mirror of
https://github.com/php/php-src.git
synced 2026-04-19 14:01:01 +02:00
convert_scalar_to_number() will now call cast_object() with an _IS_NUMBER argument, in which case the cast handler should return either an integer or floating point number, whichever is more appropriate. Previously convert_scalar_to_number() unconditionally converted objects to integers instead. Fixes bug #53033. Fixes bug #54973. Fixes bug #73108.
22 lines
434 B
PHP
22 lines
434 B
PHP
--TEST--
|
|
Bug #54973: SimpleXML casts integers wrong
|
|
--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)
|