bug69017.phpt 716 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. #69017 (Fail to push to the empty array with the constant value defined in class scope)
  3. --FILE--
  4. <?php
  5. class c1
  6. {
  7. const ZERO = 0;
  8. const ONE = 1;
  9. const MAX = PHP_INT_MAX;
  10. public static $a1 = array(self::ONE => 'one');
  11. public static $a2 = array(self::ZERO => 'zero');
  12. public static $a3 = array(self::MAX => 'zero');
  13. }
  14. c1::$a1[] = 1;
  15. c1::$a2[] = 1;
  16. c1::$a3[] = 1;
  17. var_dump(c1::$a1);
  18. var_dump(c1::$a2);
  19. var_dump(c1::$a3);
  20. ?>
  21. --EXPECTF--
  22. Warning: Cannot add element to the array as the next element is already occupied in %sbug69017.php on line %d
  23. array(2) {
  24. [1]=>
  25. string(3) "one"
  26. [2]=>
  27. int(1)
  28. }
  29. array(2) {
  30. [0]=>
  31. string(4) "zero"
  32. [1]=>
  33. int(1)
  34. }
  35. array(1) {
  36. [%d]=>
  37. string(4) "zero"
  38. }