bug53515.phpt 942 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Bug #53515 (property_exists incorrect on ArrayObject null and 0 values)
  3. --FILE--
  4. <?php
  5. $a = array('a' => 1, 'b'=> true, 'c' => 0, 'd' => null, 'e' => false, 'f' => array());
  6. $o = new ArrayObject($a, ArrayObject::ARRAY_AS_PROPS);
  7. $a['z'] = '';
  8. $a[''] = '';
  9. foreach ($a as $key => $value) {
  10. echo $key . ': ' . (is_null($value) ? 'null' : @"$value") .
  11. ' array_key_exists: ' . (array_key_exists($key, $a) ? 'true' : 'false') .
  12. ' property_exists: ' . (property_exists($o, $key) ? 'true' : 'false'),"\n";
  13. }
  14. ?>
  15. --EXPECT--
  16. a: 1 array_key_exists: true property_exists: true
  17. b: 1 array_key_exists: true property_exists: true
  18. c: 0 array_key_exists: true property_exists: true
  19. d: null array_key_exists: true property_exists: true
  20. e: array_key_exists: true property_exists: true
  21. f: Array array_key_exists: true property_exists: true
  22. z: array_key_exists: true property_exists: false
  23. : array_key_exists: true property_exists: false