xref: /PHP-7.0/Zend/tests/bug50255.phpt (revision bb179ad1)
1--TEST--
2Bug #50255 (isset() and empty() silently casts array to object)
3--FILE--
4<?php
5
6$arr = array('foo' => 'bar');
7
8print "isset\n";
9var_dump(isset($arr->foo));
10var_dump(isset($arr->bar));
11var_dump(isset($arr['foo']));
12var_dump(isset($arr['bar']));
13print "empty\n";
14var_dump(empty($arr->foo));
15var_dump(empty($arr->bar));
16var_dump(empty($arr['foo']));
17var_dump(empty($arr['bar']));
18
19?>
20--EXPECT--
21isset
22bool(false)
23bool(false)
24bool(true)
25bool(false)
26empty
27bool(true)
28bool(true)
29bool(false)
30bool(true)
31