Skip to content

Conversation

@westonruter
Copy link
Collaborator

Given this CSS:

div {
	display: inline-block;
	display:
}

I'm getting a PHP notice:

PHP Notice:  Undefined offset: 0 in .../sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Value.php on line 58

This PR fixes that problem by improving the resiliency to bad CSS.

Copy link
Collaborator

@sabberworm sabberworm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I think we should leverage the existing distinction between strict and lenient parsing modes.

Also, could you maybe add a unit test for this?

}
}
if (!isset($aStack[0])) {
return null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try to instead to throw a custom UnexpectedTokenException which, in lenient mode, should be caught already.

@westonruter
Copy link
Collaborator Author

@sabberworm thanks for the review. I've added the throwing of UnexpectedTokenException in 2c61b73 along with tests.

Copy link
Collaborator

@sabberworm sabberworm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@sabberworm sabberworm merged commit 5cf8479 into MyIntervals:master Jan 29, 2019
@westonruter westonruter deleted the fix/undefined-index branch January 29, 2019 18:26
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.

2 participants