xref: /PHP-7.2/ext/spl/tests/bug40036.phpt (revision 3a4eb3e4)
1--TEST--
2Bug #40036 (empty() does not work correctly with ArrayObject when using ARRAY_AS_PROPS)
3--FILE--
4<?php
5class View extends ArrayObject
6{
7    public function __construct(array $array = array())
8    {
9        parent::__construct($array, ArrayObject::ARRAY_AS_PROPS);
10    }
11}
12
13$view = new View();
14$view->foo = false;
15$view->bar = null;
16$view->baz = '';
17if (empty($view['foo']) || empty($view->foo)) {
18    echo "View::foo empty\n";
19}
20if (empty($view['bar']) || empty($view->bar)) {
21    echo "View::bar empty\n";
22}
23if (empty($view['baz']) || empty($view->baz)) {
24    echo "View::baz empty\n";
25}
26?>
27===DONE===
28--EXPECT--
29View::foo empty
30View::bar empty
31View::baz empty
32===DONE===
33