bug53033.phpt 371 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Bug #53033: Mathematical operations convert objects to integers
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. $x = simplexml_load_string('<x>2.5</x>');
  8. var_dump($x*1);
  9. // type of other operand is irrelevant
  10. var_dump($x*1.0);
  11. // strings behave differently
  12. $y = '2.5';
  13. var_dump($y*1);
  14. var_dump((string)$x*1);
  15. ?>
  16. --EXPECT--
  17. float(2.5)
  18. float(2.5)
  19. float(2.5)
  20. float(2.5)