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

Matching empty array always return true #13

Closed
pskt opened this issue May 29, 2014 · 0 comments
Closed

Matching empty array always return true #13

pskt opened this issue May 29, 2014 · 0 comments

Comments

@pskt
Copy link
Contributor

pskt commented May 29, 2014

Hi

I'm using php-matcher to match some JSONs and I found an issue.
If in $value will be empty array php-matcher always return true.

For example, as $value I have

{"status":"ok","data":[]}

And as $pattern

{
  "status": "ok",
  "data": [
      {
          "id": @integer@,
          "code": "123987",
          "name": "Anvill",
          "short_description": "ACME Anvill",
          "url": "http://test-store.example.com/p/123987",
          "image": {
          "url": "http://test-store.example.com/i/123987-0.jpg",
          "description": "ACME Anvill"
          },
          "price": 95,
          "promotion_description": "Anvills sale"
      },
      {
          "id": @integer@,
          "code": "123988",
          "name": "Red Anvill",
          "short_description": "Red ACME Anvill",
          "url": "http://test-store.example.com/p/123988",
          "image": {
          "url": "http://test-store.example.com/i/123988-0.jpg",
          "description": "ACME Anvill"
          },
          "price": 44.99,
          "promotion_description": "Red is cheap"
      }
  ]
}

And matcher return true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants