views:

24

answers:

1

Hello,

(I'm using PHP 5.2.6 and phpinfo says it has libxml 2.6.32 loaded)

I'm also using wordpress and whenever xml_parse() function is called I get &lt; and &gt; stripped out from the result, instead of being converted to "<" and ">".

I found people talking this is a bug which hits newer versions of libxml but I have the old one and it still happnes to me. Weird thing is that I have same PHP/libxml dev setup on my Windows WAMP based apache server and it does not happen there.

My question is do you know how can I make xml_parse behave how it should? And how can I upgrade my libxml on the Fedora prod server. yum says that libxml2 that I have installed is 2.7.2, but like I said phpinfo says libxml is 2.6.32. How to make PHP use a newer version of libxml?

Edit: For example this is what result is on my dev server:

<OrderResponse ID="XXX" Signature="XXX"><Reference>XXX</Reference><URL>http://XXX&lt;/URL&gt;&lt;ErrCode&gt;0&lt;/ErrCode&gt;&lt;ErrText&gt;&lt;/ErrText&gt;&lt;/OrderResponse&gt;

And this is what I get on my prod server:

OrderResponse ID="XXX" Signature="XXX/ReferenceURLhttp://XXX/URLErrCode0/ErrCodeErrText/ErrText/OrderResponse
A: 

Let me answer my own question.

Problem was in fact that PHP was using libxml 2.7.2 and phpinfo() was showing WRONG information about libxml... 2.6.32 version that phpinfo() was wrongly stating PHP has been using is the version PHP was compiled with, but obviously was running with libxml 2.7.2 as we seen in the list of running processes.

So, the solution is to compile libxml 2.6.32 and install it. Once PHP started with libxml 2.6.32 this problem went away.

Point of the story is don't trust what phpinfo() is telling you. Always make double checks.

Goran