From 8138aa46e2b3ad7d6a94ab42e66651880207e460 Mon Sep 17 00:00:00 2001 From: "B.G.Adrian" Date: Thu, 12 Mar 2015 18:46:31 +0200 Subject: [PATCH] Fail when an object property name is invalid --- jsv4.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jsv4.php b/jsv4.php index f6d0246..07eece5 100644 --- a/jsv4.php +++ b/jsv4.php @@ -274,6 +274,11 @@ private function checkObject() { } } } + foreach ($this->data as $key => &$subValue) { + if (isset($checkedProperties[$key]) == false){ + $this->fail(JSV4_INVALID_TYPE, "/$key", "/$key", "Object has invalid key: {$key}"); + } + } } if (isset($this->schema->additionalProperties)) { $additionalProperties = $this->schema->additionalProperties;