d-zenju / phpquery

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

getString and getStrings don't work w/ index 0 #205

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load a document.
2. $a = pq('.some_selector');
3. print $a->getString(0);

What is the expected output? What do you see instead?
Expected : "Contents of selection"
Result : "Array"

What version of the product are you using? On what operating system?
0.9.5 on Amazon Linux

Please provide any additional information below.
Fix : change first line of getString and getStrings from:
if($index)
to:
if(is_int($index))

0 evaluates as false.  Easy fix.

Original issue reported on code.google.com by msu...@gmail.com on 21 Feb 2012 at 5:29