1--TEST-- 2Bug #31098 (isset() / empty() incorrectly returns true in dereference of a wrong type) 3--FILE-- 4<?php 5$a = ''; 6var_dump(isset($a->b)); 7$a = 'a'; 8var_dump(isset($a->b)); 9$a = '0'; 10var_dump(isset($a->b)); 11$a = ''; 12var_dump(isset($a['b'])); 13$a = 'a'; 14var_dump(isset($a['b'])); 15$a = '0'; 16var_dump(isset($a['b'])); 17 18$simpleString = "Bogus String Text"; 19echo isset($simpleString->wrong)?"bug\n":"ok\n"; 20echo isset($simpleString["wrong"])?"bug\n":"ok\n"; 21echo isset($simpleString[-20])?"bug\n":"ok\n"; 22echo isset($simpleString[0])?"ok\n":"bug\n"; 23echo isset($simpleString["0"])?"ok\n":"bug\n"; 24echo isset($simpleString["16"])?"ok\n":"bug\n"; 25echo isset($simpleString["17"])?"bug\n":"ok\n"; 26echo $simpleString->wrong === null?"ok\n":"bug\n"; 27echo $simpleString["wrong"] === "B"?"ok\n":"bug\n"; 28echo $simpleString["0"] === "B"?"ok\n":"bug\n"; 29$simpleString["wrong"] = "f"; 30echo $simpleString["0"] === "f"?"ok\n":"bug\n"; 31?> 32--EXPECTF-- 33bool(false) 34bool(false) 35bool(false) 36bool(false) 37bool(false) 38bool(false) 39ok 40ok 41ok 42ok 43ok 44ok 45ok 46 47Notice: Trying to get property 'wrong' of non-object in %s on line %d 48ok 49 50Warning: Illegal string offset 'wrong' in %s on line %d 51ok 52ok 53 54Warning: Illegal string offset 'wrong' in %s on line %d 55ok 56