Bug Report #3194

arr::path error if value of wildcard array is not an array

Added by David Duymelinck about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:08/20/2010
Priority:NormalDue date:
Assignee:Woody Gilk% Done:

100%

Category:Core
Target version:v3.0.9
Resolution:fixed Points:

Description

$test = array(
        'a'=>
            array(
                'b'=>array('c'=>1),
                'd'=>2,
            )
    );

Kohana::debug(path($post,'a.*.c'));

This will result in an "array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object" error message.


Related issues

Related to Kohana v3.x - Feature Request #3279: Test for ArrayObjects and other array-like objects Closed 09/25/2010

Associated revisions

Revision 12f5dffd
Added by Woody Gilk about 4 years ago

Use Arr::is_array in Arr::path rather than in_array and return $default when $array is not an array, fixes #3194

History

#1 Updated by David Duymelinck about 4 years ago

The array name in the function call needs to be changed to $test to make the example work.

#2 Updated by Woody Gilk about 4 years ago

  • Category set to Core
  • Assignee set to Woody Gilk
  • Target version set to v3.0.8

#3 Updated by Woody Gilk about 4 years ago

  • Target version changed from v3.0.8 to v3.0.9

#4 Updated by Woody Gilk about 4 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
  • Resolution set to fixed

Also available in: Atom PDF