bug37811.phpt 542 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #37811 (define not using toString on objects)
  3. --FILE--
  4. <?php
  5. class TestClass
  6. {
  7. function __toString()
  8. {
  9. return "Foo";
  10. }
  11. }
  12. define("Bar",new TestClass);
  13. var_dump(Bar);
  14. define("Baz",new stdClass);
  15. var_dump(Baz);
  16. ?>
  17. ===DONE===
  18. --EXPECTF--
  19. string(3) "Foo"
  20. Warning: Constants may only evaluate to scalar values, arrays or resources in %sbug37811.php on line %d
  21. Warning: Use of undefined constant Baz - assumed 'Baz' (this will throw an Error in a future version of PHP) in %sbug37811.php on line %d
  22. string(3) "Baz"
  23. ===DONE===