bug39018.phpt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. --TEST--
  2. Bug #39018 (Error control operator '@' fails to suppress "Uninitialized string offset")
  3. --FILE--
  4. <?php
  5. error_reporting(E_ALL);
  6. $a = 'foo';
  7. $a[111111111111111111111];
  8. $a = '';
  9. $a[0];
  10. print $a[0]; // 12
  11. $a[-11111111111111111111111];
  12. print $a[-11111111111111111111111]; // 16
  13. $a[-0];
  14. $x = 'test';
  15. @$x[4];
  16. @$y = $x[4];
  17. @('a' == $x[4]);
  18. $x[4] == 'a'; // 28
  19. @$x[4] == 'a';
  20. (@$x[4]) == 'a';
  21. ($x[4]) == 'a'; // 34
  22. (@($x[4])) == 'a';
  23. (($x[4])) == 'a'; // 38
  24. @($x[4]) == 'a';
  25. ($x[4]) == 'a'; // 42
  26. @($x[4] == 'a');
  27. ($x[4] == 'a'); // 46
  28. $y = 'foobar';
  29. $y[12.2];
  30. print $y[12.2]; // 52
  31. $y[3.5];
  32. print $y[3.5]; // 56
  33. print "\nDone\n";
  34. ?>
  35. --EXPECTF--
  36. Notice: String offset cast occurred in %s on line %d
  37. Notice: Uninitialized string offset: %s in %s on line 6
  38. Notice: Uninitialized string offset: 0 in %s on line %d
  39. Notice: Uninitialized string offset: 0 in %s on line %d
  40. Notice: String offset cast occurred in %s on line %d
  41. Notice: Uninitialized string offset: %i in %s on line %d
  42. Notice: String offset cast occurred in %s on line %d
  43. Notice: Uninitialized string offset: %i in %s on line %d
  44. Notice: Uninitialized string offset: 0 in %s on line %d
  45. Notice: Uninitialized string offset: 4 in %s on line %d
  46. Notice: Uninitialized string offset: 4 in %s on line %d
  47. Notice: Uninitialized string offset: 4 in %s on line %d
  48. Notice: Uninitialized string offset: 4 in %s on line %d
  49. Notice: Uninitialized string offset: 4 in %s on line %d
  50. Notice: String offset cast occurred in %s on line %d
  51. Notice: Uninitialized string offset: 12 in %s on line %d
  52. Notice: String offset cast occurred in %s on line %d
  53. Notice: Uninitialized string offset: 12 in %s on line %d
  54. Notice: String offset cast occurred in %s on line %d
  55. Notice: String offset cast occurred in %s on line %d
  56. b
  57. Done