-
Notifications
You must be signed in to change notification settings - Fork 148
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
CSSRule->__toString doesn't work with sized values #3
Comments
The code in question is taking advantage of the fact that implode will call __toString() on any object it encounters (which is needed for all CSSValues, not just CSSSize). Unfortunately, older versions of PHP (pre-5.2) do not support this. I’m not sure whether to work around this or to mark it wontfix and set PHP 5.2 as the minimum requirement for this library. |
I have fixed the issue by looping through the array and calling __toString if the element is an object, using the string if it is not, and adding commas accordingly. I can send you a diff if you would like. |
I would be very interested in those changes you made to the CSSDocument. Just fork my repository and push your changes. |
I think I have committed my changes. I am a noob @ both git and github, so please let me know either way if you can or cannot see my changes or if I did it incorrectly. |
You need to use the “git push” command to push changes that you’ve checked in to the github repository. |
Ok. Done. |
I’ve commented on your commits. Please send a pull request after having worked through them so I can merge your changes. |
I think we’re dropping PHP pre-5.2 so I’ll close this. |
> Error Message: preg_split(): Passing null to parameter MyIntervals#3 ($limit) of type int is deprecated see MyIntervals#338 (cherry picked from commit 84b3ba7)
> Error Message: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated see MyIntervals#338
If I have a CSS rule as follows (this is in your example css):
div.rating-cancel,div.star-rating{width:17px;height:15px;}
The CSSRule->__toString either throws an error, or it looks like this:
width: Object;
The problem is on line 707 when it tries to implode a comma into the values. When a value is a CSSSize, it produces the above result.
For you to test this, in your CSSParserTests.php file,
change line 19 to:
$oDoc = $oParser->parse();
and add this line after the catch clause
echo $oDoc->__toString();
The text was updated successfully, but these errors were encountered: