Skip to content

Commit 143e8d1

Browse files
morozovSeldaek
authored andcommitted
Do not call strlen() on null (jsonrainbow#657)
1 parent 2ba9c8c commit 143e8d1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/JsonSchema/Constraints/Constraint.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ abstract class Constraint extends BaseConstraint implements ConstraintInterface
4242
protected function incrementPath(JsonPointer $path = null, $i)
4343
{
4444
$path = $path ?: new JsonPointer('');
45+
46+
if ($i === null || $i === '') {
47+
return $path;
48+
}
49+
4550
$path = $path->withPropertyPaths(
4651
array_merge(
4752
$path->getPropertyPaths(),
48-
array_filter(array($i), 'strlen')
53+
array($i)
4954
)
5055
);
5156

0 commit comments

Comments
 (0)