php5.4の文字列オフセットが厳密になった件
こーゆーコードでIllegal string offsetが出ました。
php5.3では出ませんでした。
<?php function methodA() { $param['id'] = "1,2,3,4,5,6"; $this->methodB($param['id']); } function methodB($param) { //Illegal string offset 'id' explode(',',$param['id']); }
配列を渡しているつもりが間違えて文字列渡しているのに、謎の添え字でアクセスできること自体いかんのではないでしょうか・・・。
$str = 'abdce'; echo $str[2];なら理解できるけど。あー、きもい。