ZF-7564: CSS and XPath assertions/queries do not work when document begins with XML declaration

Issue Type: Bug Created: 2009-08-11T15:49:07.000+0000 Last Updated: 2011-11-08T13:47:23.000+0000 Status: Resolved Fix version(s): Reporter: Wojciech Szela (wojciech.szela) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Dom_Query

  • Zend_Test_PHPUnit

Related issues: - ZF-11376



The following test fails:

<pre class="highlight">
class MyTest extends Zend_Test_PHPUnit_ControllerTestCase
    public function testFoo()

when requested document begins with XML declaration:

<pre class="highlight">
<?xml version="1.0" encoding="UTF-8" ?>

and passes if there is no such declaration.

What is more interesing

<pre class="highlight">

passes. Same applies to corresponding XPath queries (CSS queries are translated into XPath queries):

<pre class="highlight">

fails, but the following passes

<pre class="highlight">


Posted by Benjamin Eberlei (beberlei) on 2009-09-18T01:18:24.000+0000

Could you maybe investigate if this is a problem with Zend_Dom_Query instead?

Posted by Wojciech Szela (wojciech.szela) on 2009-09-23T09:35:37.000+0000

Yes, the bug itself is in Zend_Dom_Query component, but since Zend_Test_PHPUnit is using it, both components are affected. Anyway, the query component should be fixed.

Posted by Matthew Weier O'Phinney (matthew) on 2010-01-21T09:28:12.000+0000

I've tried a number of documents with the XML declaration, and in all cases, the queries you specified worked fine -- both the CSS selector and XPath queries.

If you can provide sample content and queries that fail, please re-open this issue or open a new one.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.