ZF-4010: assertQueryContentContains() crashes PHP on attribute value query
Issue Type:
Bug
Created:
2008-08-20T06:02:11.000+0000
Last Updated:
2009-09-18T08:56:24.000+0000
Status:
Resolved
Fix version(s):
1.9.3 (22/Sep/09)
Reporter:
Stefan Gehrig (sgehrig)
Assignee:
Stefan Gehrig (sgehrig)
Tags:
Zend_Test_PHPUnit
Related issues:
Attachments:
Description
Faxnummern
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2008-09-11T07:06:46.000+0000
The problem isusing @value -- this syntax is not supported by Zend_Dom_Query. You can query for the value of an arbitrary attribute using some alternate CSS style notation; please see http://framework.zend.com/manual/en/… for more information.
Currently, there is no support for finding simply the existence of an arbitrary attribute, only for testing against the value of an arbitrary attribute. If you would like the former functionality (existence of arbitrary attribute), please open a separate feature request.
Posted by Stefan Gehrig (sgehrig) on 2008-09-11T09:46:01.000+0000
Hi Matthew,
sorry, but I can't follow your comment... I'm trying to test against the value of an attribute (the {{value}}-Attribute of an {{}}-Tag).
The problem obviously is not {{Zend_Dom_Query}} as the following works as expected:
$query=new Zend_Dom_Query($string); // $string from example above
$result=$query->query('input#fax-0 @value');
var_dump($result);
foreach ($result as $r) {
var_dump($r->value);
}
{{Zend_Dom_Query}} translates this into {{//input[@id='fax-0']//@value}} and gives the following output
This is exactly what I want. But when using the query from above in a {{Zend_Test_PHPUnit_Constraint_DomQuery}} PHP crashes most obviously due to the code of {{Zend_Test_PHPUnit_Constraint_DomQuery::_getNodeContent(DOMNode $node)}} which reads:
Posted by Stefan Gehrig (sgehrig) on 2009-09-18T01:43:10.000+0000
Fixed in r18224.
Zend_Test_PHPUnit_Constraint_DomQuery allows matching of attribute values.
Although the original issue seems to be related to the PHP version used, the present fix is PHP version independent.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2008-09-11T07:06:46.000+0000
The problem isusing @value -- this syntax is not supported by Zend_Dom_Query. You can query for the value of an arbitrary attribute using some alternate CSS style notation; please see http://framework.zend.com/manual/en/… for more information.
Currently, there is no support for finding simply the existence of an arbitrary attribute, only for testing against the value of an arbitrary attribute. If you would like the former functionality (existence of arbitrary attribute), please open a separate feature request.
Posted by Stefan Gehrig (sgehrig) on 2008-09-11T09:46:01.000+0000
Hi Matthew,
sorry, but I can't follow your comment... I'm trying to test against the value of an attribute (the {{value}}-Attribute of an {{}}-Tag).
The problem obviously is not {{Zend_Dom_Query}} as the following works as expected:
{{Zend_Dom_Query}} translates this into {{//input[@id='fax-0']//@value}} and gives the following output
This is exactly what I want. But when using the query from above in a {{Zend_Test_PHPUnit_Constraint_DomQuery}} PHP crashes most obviously due to the code of {{Zend_Test_PHPUnit_Constraint_DomQuery::_getNodeContent(DOMNode $node)}} which reads:
This doesn't work id {{$node}} is a {{DOMAttr}}.
Posted by Stefan Gehrig (sgehrig) on 2009-09-18T01:43:10.000+0000
Fixed in r18224. Zend_Test_PHPUnit_Constraint_DomQuery allows matching of attribute values. Although the original issue seems to be related to the PHP version used, the present fix is PHP version independent.