#49002 [Opn->Fbk]: XML Encoding differs when using XML with or without XML-Writer
ID: 49002
Updated by: jani@php.net
Reported By: kh dot wild at wicom dot li
-Status: Open
+Status: Feedback
Bug Type: XML Writer
Operating System: FreeBSD 6.4
PHP Version: 5.2.10
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2009-07-21 14:07:24] 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. < and > 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. > and < 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 13:53:53] 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 13:43:10] 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<br>
<br>
blah, Agentur für Werbung und Kommunikation GmbH<br>
<a href="http://www.blah blah/"
target="_blank" style="color: #000000;">www.blah
blah</a></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
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49002&edit=1
Thread (4 messages)