fix(view): fix falsy boolean evaluation on comments #1289
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When parsing HTML comments, any
0
character (like in URLs such ashttp://www.w3.org/2000/svg
) was being treated as "false" in PHP. This made the lexer stop parsing too early and break up the comment before it was supposed to.Root Cause
PHP treats the string
"0"
as false, so when$this->current === '0'
, the loop condition fails and exits before finding the actual closing-->
.Fix
We just need to be more specific about checking for null instead of relying on PHP's truthiness:
Explicit
null
check FTW.Relates to #1288 (failing PR, merge this first)
Fixes #1287