-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
The CssSelector throws a warning for unsupported selectors #11947
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
Comments
OK, this is even worse than I thought: the warning triggered by |
That's interesting indeed :) This is a PHP bug, array_map has no reason to trigger a warning. |
Is replacing calls to |
well, the easy workaround would be to use a foreach loop rather than array_map in the Translator, where throwing an exception inside the callback is something expected sometimes. Anyway, this is too bad for functional programming in PHP if array_map is broken... |
The only side effect of the warning is a line in the php log file, with no userland side effect (as any custom error handler is not called). This is bad, but not a blocker... |
Well, I find it a bit annoying, as it is filling my output when running the testsuite of my project at work. The warning does not end up in the log files, but in the output in such case (well, probably STDERR, but it does not make a difference on Travis as they get mixed together) |
For reference, this was reported to PHP 3 years ago: https://bugs.php.net/bug.php?id=55416 |
…n (xabbuh) This PR was merged into the 2.3 branch. Discussion ---------- [CssSelector] don't raise warnings when exception is thrown | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #11947 | License | MIT | Doc PR | `array_map()` raises a warning when an exception is thrown inside the callback (see https://bugs.php.net/bug.php?id=55416). To avoid these warnings, `selectorToXPath()` is applied inside the loop. Commits ------- 38e9623 don't raise warnings when exception is thrown
When a CSS selector contains an unsupported selector (
:active
for instance), the component will throw an exception. However, it will also throw a warning because of the behavior ofarray_map
when an exception is thrown in its callback: http://3v4l.org/rDT3RThis is annoying, especially when trying to catch the exception to ignore the unsupported selector.
The text was updated successfully, but these errors were encountered: