Issue Type: Bug Created: 2009-04-12T21:21:17.000+0000 Last Updated: 2010-01-21T09:46:28.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)
Reporter: Matthew Turland (elazar) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Dom_Query
Related issues: - ZF-6280
Zend_Dom_Query::query() calls Zend_Dom_Query_Css2XPath::transform(), which can return an array. It passes this as $xpathQuery to Zend_Dom_Query::queryXPath(), which passes it to Zend_Dom_Query::_getNodeList(). According to the docblock for this method, $xpathQuery may be a string or an array. However, this method explicitly casts $xpathQuery to a string, which results in that variable being equal to the string "Array" if the original value for $xpathQuery is an array.
In my opinion, it would be best for the sake of consistency to restrict $xpathQuery to be a string for both queryXPath() and _getNodeList() and to modify Zend_Dom_Query_Css2XPath::transform() so that it only ever returns a string.
Posted by Satoru Yoshida (satoruyoshida) on 2009-07-29T19:37:25.000+0000
Is it still alive after ZF-6280 fix?
Posted by Matthew Turland (elazar) on 2009-07-29T19:54:04.000+0000
Yes, this issue is still applicable. ZF-6280 only corrected API docblocks. This deals with corresponding source code. The reason that the two issues are related is because the fix from ZF-6280 (updating the API docblocks to reflect that the parameter/return types could be string or array) affects how this issue should be handled.
If both strings and arrays are to be allowed, line 207 of Zend/Dom/Query.php in trunk (in _getNodeList() where $xpathQuery is typecasted to a string) needs to be modified to handle actually allowing arrays rather than assigning the string 'Array' to $xpathQuery.
As a side note, it seems odd that _getNodeList() is even separated from queryXpath(), as the latter is the only thing that calls the former.
Posted by Victor Gryshko (hohol) on 2009-10-06T02:50:53.000+0000
I've resolved this issue on my end (ZF version 1.9.3) by using the following line in Css2Xpath.php (line 52)
return implode(' | ', $expressions);
Posted by Matthew Weier O'Phinney (matthew) on 2010-01-21T09:46:28.000+0000
Fixed in trunk and 1.10 release branch
Have you found an issue?
See the Overview section for more details.