Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not call strlen() on null #657

Merged
merged 2 commits into from
Jul 21, 2021
Merged

Do not call strlen() on null #657

merged 2 commits into from
Jul 21, 2021

Conversation

morozov
Copy link
Contributor

@morozov morozov commented Feb 23, 2021

Fixes #656.

@morozov morozov changed the title Do not call strelen() on null Do not call strlen() on null Feb 23, 2021
@ktomk
Copy link
Contributor

ktomk commented May 2, 2021

Just a suggestion to solve this issue less invasive (better maintainability) on the original code https://github.com/justinrainbow/json-schema/blob/6d04026ebc25e8ea0594a345eaa387f2ccb3b3e5/src/JsonSchema/Constraints/Constraint.php#L49

array_filter((array)$i, 'strlen') 

and no other change (maybe a space after the cast operator depending on code-style).

and while touching this area, for the calling function https://github.com/justinrainbow/json-schema/blob/f4f0c3457811006f861c466a10c6c24f3e92f9ae/src/JsonSchema/Constraints/UndefinedConstraint.php#L40

$path = $this->incrementPath($path, $i);

as $path param is null-able. but that could be on a different commit, perhaps earlier already in master, and must not go into this PR.

the build is choking on the php-cs-fixer no_superfluous_phpdoc_tags rule, I recommend to remove it from configuration as it is incompatible with the code-style.

just my 2 cents.

@andypost
Copy link

There's duplicate #666

@Seldaek Seldaek merged commit 8ce4da2 into jsonrainbow:master Jul 21, 2021
Seldaek pushed a commit to Seldaek/json-schema that referenced this pull request Jul 21, 2021
@Seldaek Seldaek mentioned this pull request Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecation notice on PHP 8.1
7 participants