PHP/5.2.5

16 views
Skip to first unread message

Álvaro G. Vicario

unread,
Jan 9, 2009, 7:22:08 AM1/9/09
to phpQuery
Is there any known issue with PHP/5.2.5 and phpQuery?

I've developed a site where I use phpQuery to parse XML files and it
works fine in my computer. However, when I run it in another box
phpQuery is unable to fetch data. Calls to the attr() method return
empty strings. A simplified fragment:

<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly'>
<s:AttributeType name='ComparteElementoComun_ID' rs:number='1'
rs:maydefer='true' rs:writeunknown='true'>
<s:datatype dt:type='int' dt:maxLength='4' rs:precision='10'
rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='ComparteElementoComun' rs:number='2'
rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
<s:datatype dt:type='string' dt:maxLength='100'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>


foreach($this->xml['schema elementtype attributetype'] as $campo){
if( count(pq($campo)->find('datatype'))==1 ){
$tipo = pq($campo)->find('datatype')->get(0);
echo pq($tipo)->attr('dt:type'); // Should print "string" but prints
""
}
}


Both code and data are exactly the same. Both servers run PHP as
Apache 2.2 module in a Windows box. The only significant difference I
could find is that my computer runs PHP/5.2.6 and the computer where
it fails runs PHP/5.2.5.

Tobiasz Cudnik

unread,
Jan 9, 2009, 8:40:52 AM1/9/09
to phpQuery
This indeed looks like bug related to PHP, exactly DOM extension. It
may be related with #38474 in PHP 5.2.5
http://bugs.php.net/bug.php?id=38474
Although description differs a bit.

BTW i see your using xml namespaces (documents with them at least).
Support for those is still quite early and if you notice some problem,
please update following ticket
http://code.google.com/p/phpquery/issues/detail?id=25

Álvaro G. Vicario

unread,
Jan 9, 2009, 8:50:17 AM1/9/09
to phpQuery
On 9 ene, 14:40, Tobiasz Cudnik <tobiasz.cud...@gmail.com> wrote:
> This indeed looks like bug related to PHP, exactly DOM extension. It
> may be related with #38474 in PHP 5.2.5http://bugs.php.net/bug.php?id=38474
> Although description differs a bit.

That bug was fixed in 5.2.0 so it must be something else:

http://www.php.net/ChangeLog-5.php

Whatever, you're right: it looks like a PHP bug... I guess I'll just
add "PHP 5.2.6 or greater" to my app specs.


> BTW i see your using xml namespaces (documents with them at least).
> Support for those is still quite early and if you notice some problem,
> please update following ticket http://code.google.com/p/phpquery/issues/detail?id=25

I'll take it into account, but it's definitively working for me. I
chose phpQuery precisely because it was the first library that could
parse my namespaced data ;-)

Tobiasz Cudnik

unread,
Jan 9, 2009, 11:12:31 PM1/9/09
to phpQuery
I've mixed things up. I found this QA test
http://marc.info/?l=php-qa&m=120031426708689&w=2
according to which test for #38474 bug failed. That doesn't mean that
there was a regression, but it means that getAttribute was generally
broken.

On Jan 9, 2:50 pm, Álvaro G. Vicario <alv...@demogracia.com> wrote:
> On 9 ene, 14:40, Tobiasz Cudnik <tobiasz.cud...@gmail.com> wrote:
>
> > This indeed looks like bug related to PHP, exactly DOM extension. It
> > may be related with #38474 in PHP 5.2.5http://bugs.php.net/bug.php?id=38474
> > Although description differs a bit.
>
> That bug was fixed in 5.2.0 so it must be something else:
>
> http://www.php.net/ChangeLog-5.php
>
> Whatever, you're right: it looks like a PHP bug... I guess I'll just
> add "PHP 5.2.6 or greater" to my app specs.
>
> > BTW i see your using xml namespaces (documents with them at least).
> > Support for those is still quite early and if you notice some problem,
> > please update following tickethttp://code.google.com/p/phpquery/issues/detail?id=25
>
> I'll take it into account, but it's definitively working for me. I
> chose phpQuery precisely because it was the first library that could
> parse my namespaced data ;-)

That's great. Adding namespaces was fun (mainly the default one for
XHTML). Have you used the | selector ?

Álvaro G. Vicario

unread,
Jan 15, 2009, 12:38:01 PM1/15/09
to phpQuery
Álvaro G. Vicario ha escrito:
> Is there any known issue with PHP/5.2.5 and phpQuery?
>
> I've developed a site where I use phpQuery to parse XML files and it
> works fine in my computer. However, when I run it in another box
> phpQuery is unable to fetch data. Calls to the attr() method return
> empty strings.

Definitively, the problem lays in the combination of attr() and
namespaces:

With a node like <s:datatype dt:type='string' dt:maxLength='100'/> we
have:

* PHP/5.2.5: Only attr('type') works
* PHP/5.2.6: Only attr('dt:type') works

I'll try the latest phpQuery snapshot when I have the chance but this
looks like a libxml issue.
Reply all
Reply to author
Forward
0 new messages