Skip to content

Add null coalescing (??) operator passing arr arg to _load_item

Latest
Compare
Choose a tag to compare
@george-clippings george-clippings released this 08 Jan 14:01
1441a3a

When we are using the jam with PHP 7.3 and if $this->_content is null following:

$this->_content[$offset]

here and there works without warnings.

From PHP 7.4 when you try to do it you will have a Notice. The following example is with PHP 7.4.13:

$ php -a
Interactive mode enabled

php > $foo=null;
php > $foo['bar'];
PHP Notice:  Trying to access array offset on value of type null in php shell code on line 1
PHP Stack trace:
PHP   1. {main}() php shell code:0

To avoid the Notice I added the checks in this PR.

php > $foo['bar']??null;
php >