Skip to content

The BaseNode::walk() method raises a type error if the input is supposed to have children, but a scalar is received. #15

@aramonc

Description

@aramonc

For properties that are supposed to be objects, if the user passes a scalar, the array_key_exists method in BaseNode::walk() raises a type error instead of an invalid input exception.

Sample code:

class Handler extends InputHandler
{
  public function define()
  {
    $this->add('endpoint', Endpoint::class, [
            'required' => true,
            'handler' => new EndPointHandler(),
            'instantiator' => new EndPointInstantiator(),
        ]);
  }
}

Sample input:

{
  "endpoint": "https://local.liniopay.com",
}

Actual error raised:

{
  "exception_class":"TypeError",
  "exception_message":"array_key_exists() expects parameter 2 to be array, string given",
  "exception_code":0,"exception_file":"/vagrant/vendor/linio/input/src/Node/BaseNode.php",
  "exception_line":214
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions