xref: /PHP-8.2/ext/spl/tests/bug40036.phpt (revision a555cc0b)
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--EXPECT--
28View::foo empty
29View::bar empty
30View::baz empty
31