Can't access model data using Model name in CakePHP 2.x with PHP version 5.3.27 -
on development server, installed php (5.5), mysql , apache. hosting company supports php version 5.3.27. don't work in php, might missing obvious here, problems following:
cakesession::read('user.stuff')['more_stuff']; // works on 5.5 cakesession::read('user.stuff')['more_stuff']; // syntax error on 5.3... wat?! i managed fix above issue assigning cakesession::read('user.stuff') temp variable, , accessing more stuff $tmp['more_stuff'].
however, have bigger problem. can't seem access model names model name in arrays returned databases. namely, following code stopped working:
$some_model['modelname']['model_field']; //works on 5.5 $some_model['modelname']['model_field']; //warning 'modelname' being non-existant index. when try $some_model[0]['model_field'] works fine.
cheers!
edit: ok, turns out < php 5.4 doesn't support subscripting return values. still weird, explains first problem.
as found out, array dereferencing function/method call expressions supported of php 5.4, nothing special it, it's feature of newer php versions.
your other problem not string indices magically don't work anymore, structure of array accessing different.
where difference might stem from? pretty hard tell without context. should provide code can used reproduce situation, , should more debugging on own, trace function call flow , check @ point data becomes different.
Comments
Post a Comment