offset_long.phpt 1.1 KB

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