Broken empty() and isset()
$string = 'abc';
var_dump(isset($string['test'])); // true var_dump(!empty($string['test'])); //true
var_dump($string['test']); // a
HipHop's behavior is consistent with Zend 5.3 but the behavior has changed in 5.4:
seanc@[redacted]:~$ hhvm test.php bool(true) bool(true) string(1) "a"
seanc@[redacted]:~$ zend53 test.php bool(true) bool(true) string(1) "a"
seanc@[redacted]:~$ zend54 test.php bool(false) bool(false)
Warning: Illegal string offset 'test' in /home/seanc/test.php on line 8 string(1) "a"
Feel free to submit a patch if you're interested in getting this fixed sooner.
As an update, @paroski is working on this.
HHVM matches PHP5.5 and PHP5.6 for the sample code, aside from not raising a warning (which we plan to add some time in the coming months). Closing this issue out since we're compatible, if you see any other issues with isset() and empty() feel free to open a new github issue.