I don’t know exactly whether this is a bug or a feature. But when I’m using Arr:map for multidimensional array like this

Array ( [user] => Array ( [add] => some ) [test] => test )

And when I want to apply some function with

$keys = array ('add')

, it has been applied to all items! I mean if some of key is located beneath the first layer it is ignored. This happens because of this line (SYSPATH/classes/kohana/arr.php, 372):

$array[$key] = Arr::map($callback, $array[$key]);

I think it should’ve been changed to

$array[$key] = Arr::map($callback, $array[$key], $keys);

Original post in kohana community.

Share
Posted By admin

Leave a Reply

You must be logged in to post a comment.