1
0
mirror of https://github.com/php/php-src.git synced 2026-04-17 21:11:02 +02:00
Files
archived-php-src/ext/simplexml/tests/bug53033.phpt
Nikita Popov b2b2b437af Add _IS_NUMBER as cast_object() target type
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.
2017-12-26 12:39:06 +01:00

22 lines
346 B
PHP

--TEST--
Bug #53033: Mathematical operations convert objects to integers
--FILE--
<?php
$x = simplexml_load_string('<x>2.5</x>');
var_dump($x*1);
// type of other operand is irrelevant
var_dump($x*1.0);
// strings behave differently
$y = '2.5';
var_dump($y*1);
var_dump((string)$x*1);
?>
--EXPECT--
float(2.5)
float(2.5)
float(2.5)
float(2.5)