bug33999.phpt 486 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #33999 (object remains object when cast to int)
  3. --INI--
  4. error_reporting=4095
  5. --FILE--
  6. <?php
  7. class Foo {
  8. public $bar = "bat";
  9. }
  10. $foo = new Foo;
  11. var_dump($foo);
  12. $bar = (int)$foo;
  13. var_dump($bar);
  14. $baz = (float)$foo;
  15. var_dump($baz);
  16. ?>
  17. --EXPECTF--
  18. object(Foo)#1 (1) {
  19. ["bar"]=>
  20. string(3) "bat"
  21. }
  22. Warning: Object of class Foo could not be converted to int in %s on line %d
  23. int(1)
  24. Warning: Object of class Foo could not be converted to float in %s on line %d
  25. float(1)