Skip to content

Commit

Permalink
Do not call strlen() on null (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov authored Jul 21, 2021
1 parent cd26b16 commit 8ce4da2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/JsonSchema/Constraints/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,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)
)
);

Expand Down

0 comments on commit 8ce4da2

Please sign in to comment.