offset_bool.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --TEST--
  2. using different variables to access boolean offsets
  3. --FILE--
  4. <?php
  5. $bool = TRUE;
  6. var_dump($bool[1]);
  7. var_dump($bool[0.0836]);
  8. var_dump($bool[NULL]);
  9. var_dump($bool["run away"]);
  10. var_dump($bool[TRUE]);
  11. var_dump($bool[FALSE]);
  12. $fp = fopen(__FILE__, "r");
  13. var_dump($bool[$fp]);
  14. $obj = new stdClass;
  15. var_dump($bool[$obj]);
  16. $arr = Array(1,2,3);
  17. var_dump($bool[$arr]);
  18. echo "Done\n";
  19. ?>
  20. --EXPECTF--
  21. Warning: Trying to access array offset on value of type bool in %s on line %d
  22. NULL
  23. Warning: Trying to access array offset on value of type bool in %s on line %d
  24. NULL
  25. Warning: Trying to access array offset on value of type bool in %s on line %d
  26. NULL
  27. Warning: Trying to access array offset on value of type bool in %s on line %d
  28. NULL
  29. Warning: Trying to access array offset on value of type bool in %s on line %d
  30. NULL
  31. Warning: Trying to access array offset on value of type bool in %s on line %d
  32. NULL
  33. Warning: Trying to access array offset on value of type bool in %s on line %d
  34. NULL
  35. Warning: Trying to access array offset on value of type bool in %s on line %d
  36. NULL
  37. Warning: Trying to access array offset on value of type bool in %s on line %d
  38. NULL
  39. Done