| 1 | <?php |
||
| 14 | class SafeXPath extends DOMXPath |
||
| 15 | { |
||
| 16 | private $errors; |
||
| 17 | |||
| 18 | 2 | public function onQueryError($errno, $errstrs) |
|
| 22 | |||
| 23 | /** |
||
| 24 | * @param string $xpath |
||
| 25 | * @param DOMNode|null $scope |
||
| 26 | * @throws InvalidArgumentException If xpath is not valid |
||
| 27 | * @return DOMNodeList|false |
||
| 28 | */ |
||
| 29 | 3 | public function query($xpath, DOMNode $scope = null, $registerNodeNS = null) |
|
| 43 | } |
||
| 44 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.