pein0119 / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

:contains selector throws warning #145

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
<?php
// Error reporting and display turned on
$html = file_get_contents('<use the file attached>');
$rows = pq('table:has(td:contains(Grundstücksfläche))');
?>

What is the expected output? What do you see instead?
$rows contains all table rows. Additionally an php warning is thrown for
each element that has an empty text node:

Warning:  mb_stripos() [function.mb-stripos]: Empty haystack in
phpQuery.class.php on line 2019

What version of the product are you using? On what operating system?
0.9.5 r386 on Debian 2.6.26-2-686

Suggested Fix:
change 2016: if (mb_stripos($node->textContent, $text) === false)
to: if (mb_strlen($node->textContent) == 0 ||
mb_stripos($node->textContent, $text) === false)

For some strange reason empty() didn't work, although the docs say that
string(0) "" is being caught and var_dump reports so.

Original issue reported on code.google.com by laurens....@gmail.com on 9 Mar 2010 at 12:18

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry, it is row 2019 not 2016.

Original comment by laurens....@gmail.com on 9 Mar 2010 at 12:19