diff --git a/src/JsonSchema/Constraints/FormatConstraint.php b/src/JsonSchema/Constraints/FormatConstraint.php index d2b853fe..839debcc 100644 --- a/src/JsonSchema/Constraints/FormatConstraint.php +++ b/src/JsonSchema/Constraints/FormatConstraint.php @@ -89,8 +89,8 @@ public function check(&$element, $schema = null, JsonPointer $path = null, $i = } elseif (substr($element, 0, 1) === '/') { // absolute-path reference $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE); } elseif (strlen($element)) { // relative-path reference - $pathParts = explode('/', $element, 2)[0]; - if ($pathParts[0] !== '.' && strpos($pathParts, ':') !== false) { + $pathParts = explode('/', $element, 2); + if ($pathParts[0][0] !== '.' && strpos($pathParts[0], ':') !== false) { $validURL = null; } else { $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);