exception - PHP 5.5.16 Illegal offset type in isset or empty -
i'm working laravel here (semi-irrelevant) , running weird php issues i've not seen before. receiving exception error:
illegal offset type in isset or empty
the code in laravel framework (illuminate\view\factory.php), , relevant snippet throwing error is:
if (isset($this->aliases[$view])) $view = $this->aliases[$view]; now, understand if pass array or object in array key, throw error. but, dumped out $this->aliases , received:
array(0) { } and dumped out $view , received:
string(11) "layouts.app" so, regardless of fact array empty, call isset should return false string key not set.
i don't believe should error @ all, there setting in php.ini can cause such strict errors can change or not understanding fundamental operation of isset() method?
edit
this must related mihai stancu's comment below. tested , works fine without exception:
$key = 'test-key'; $test = array(); if (isset($test[$key])) var_dump('yep'); else var_dump('nope'); that outputs "nope" expected.
simply declare $something = aliases[$view] , parse string ,
if (isset($this->$something))
Comments
Post a Comment