php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49002 XML Encoding differs when using XML with or without XML-Writer
Submitted: 2009-07-21 13:43 UTC Modified: 2009-07-29 01:00 UTC
From: kh dot wild at wicom dot li Assigned:
Status: No Feedback Package: XML Writer
PHP Version: 5.2.10 OS: FreeBSD 6.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
44 + 9 = ?
Subscribe to this entry?

 
 [2009-07-21 13:43 UTC] kh dot wild at wicom dot li
Description:
------------
We had a problem with typo3 and templavoila after updateing to 5.2.10.
The problem was that the prevues given string with < and > was 
removed in the current version.

We had the extensions 

extension=eaccelerator.so
extension=zip.so
extension=simplexml.so
extension=session.so
extension=xml.so
extension=pcre.so
extension=filter.so
extension=gd.so
extension=json.so
extension=zlib.so
extension=bz2.so
extension=openssl.so
extension=ctype.so
extension=spl.so
extension=dom.so
extension=mysql.so
extension=mcrypt.so

installed

After XML-Write and XML-Reader the behavior becomes the same as with 
the version 5.2.9.

extension=xmlwriter.so
extension=xmlreader.so



Reproduce code:
---------------
<?php

        $data = '<?' . 'xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
   <field_content type="array">
   <vDEF>Casestudy www.blah blah&lt;br&gt;
        &lt;br&gt;
        blah, Agentur f?r Werbung und Kommunikation GmbH&lt;br&gt;
        &lt;a href=&quot;http://www.blah blah/&quot; target=&quot;_blank&quot; style=&quot;color: #000000;&quot;&gt;www.blah blah&lt;/a&gt;</vDEF>
        </field_content>
        </T3FlexForms>';

        $parser = xml_parser_create();
        $vals = $index = $match = Array();

    xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
    xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 0 );
    xml_parser_set_option( $parser, XML_OPTION_TARGET_ENCODING, 'iso-8859-1' );

    xml_parse_into_struct( $parser, $data, $vals, $index );
         print_r( $vals );

         xml_parser_free( $parser );
?>






Expected result:
----------------
Array
(
    [0] => Array
        (
            [tag] => field_content
            [type] => open
            [level] => 1
            [attributes] => Array
                (
                    [type] => array
                )

            [value] => 
   
        )

    [1] => Array
        (
            [tag] => vDEF
            [type] => complete
            [level] => 2
            [value] => Casestudy www.mohrenbrauerei.at<br>
        <br>
        blah, Agentur f<C3><BC>r Werbung und Kommunikation GmbH<br>
        <a href="http://www.blah blah/" target="_blank" style="color: 
#000000;">www.blah blah</a>
        )

    [2] => Array
        (
            [tag] => field_content
            [value] => 
        
            [type] => cdata
            [level] => 1
        )

    [3] => Array
        (
            [tag] => field_content
            [type] => close
            [level] => 1
        )

)


Actual result:
--------------
Array
(
    [0] => Array
        (
            [tag] => field_content
            [type] => open
            [level] => 1
            [attributes] => Array
                (
                    [type] => array
                )

            [value] => 
   
        )

    [1] => Array
        (
            [tag] => vDEF
            [type] => complete
            [level] => 2
            [value] => Casestudy www blah blahbr
        br
        blah, Agentur f<C3><BC>r Werbung und Kommunikation GmbHbr
        a href="http://www.blah blah/" target="_blank" style="color: 
#000000;"www.blah blah/a
        )

    [2] => Array
        (
            [tag] => field_content
            [value] => 
        
            [type] => cdata
            [level] => 1
        )

    [3] => Array
        (
            [tag] => field_content
            [type] => close
            [level] => 1
        )

)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-21 13:53 UTC] jani@php.net
After what comes what now? What do you do get the expected behaviour and what you don't do? Did you really update everything, including those extensions? Hint: Try removing all existing stuff prior to doing 'make install'.
 [2009-07-21 14:07 UTC] kh dot wild at wicom dot li
Sorry if my explanation is a bit confusing.

We installed the new version with portupgrade and afterwards
we forced the new installation again with the same result.

We solved the problem but the behavior seems
not to be the same in 5.2.9 and 5.2.10.

When using the xml_parser in 5.2.9 we got the right
result. &lt; and &gt; were in the source and were correct
transformed to < and >.

In 5.2.10 this strings were removed. After additionally 
installing the extensions xml-writer and xml-reader we got 
the same result as in 5.2.9. &gt; and &lt; wasn't removed
anymore. It seems that the encoding and decoding differs
when different extensions are installed.

in 5.2.9 we've installed only xml and all worked perfect.
In 5.2.10 we had to install xml-reader and xml-writer to get
the same result.

Please drop me a note if there is some question open.)
 [2009-07-21 18:43 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-07-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC