Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aramonc opened this issue Jan 26, 2017 · 2 comments
Labels

Comments

@aramonc
Copy link

aramonc commented Jan 26, 2017

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
}
@klaussilveira
Copy link
Contributor

Most nodes relied on the dynamic features of PHP to do a little magic. Since we're getting stricter and stricter since 7.0, we do have to review and adapt some assumptions we made in the past.

@stale
Copy link

stale bot commented Jul 7, 2018

This issue has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the stale label Jul 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants