From 143e8d13445ee071602699c2a96d792a7051ec96 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 21 Jul 2021 06:57:00 -0700 Subject: [PATCH] Do not call strlen() on null (#657) --- src/JsonSchema/Constraints/Constraint.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/JsonSchema/Constraints/Constraint.php b/src/JsonSchema/Constraints/Constraint.php index a53130df..c61b89ad 100644 --- a/src/JsonSchema/Constraints/Constraint.php +++ b/src/JsonSchema/Constraints/Constraint.php @@ -42,10 +42,15 @@ abstract class Constraint extends BaseConstraint implements ConstraintInterface protected function incrementPath(JsonPointer $path = null, $i) { $path = $path ?: new JsonPointer(''); + + if ($i === null || $i === '') { + return $path; + } + $path = $path->withPropertyPaths( array_merge( $path->getPropertyPaths(), - array_filter(array($i), 'strlen') + array($i) ) );