Bug #14325 Updated: set_attribute does not keep '&' in character references

From: Date: Mon, 03 Dec 2001 22:53:04 +0000
Subject: Bug #14325 Updated: set_attribute does not keep '&' in character references
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-72403@lists.php.net to get a copy of this message
ID: 14325 Updated by: mfischer Reported By: andrew@boxuk.com Old Status: Open Status: Bogus Bug Type: DOM XML related Operating System: Redhat 7.0 PHP Version: 4.0.5 New Comment: You actually ran into a feature of libxml2. It does automatic character encoding. I remember it was discussed to implement a function to set raw attributes but as far as I know the current version it's not implemented so there's little we can do about it (but I would be happy to be proved being wrong here). Not a PHP bug -> bogusifying. Previous Comments: ------------------------------------------------------------------------ [2001-12-03 11:39:37] andrew@boxuk.com The '&' in character references is converted to &amp; when used in set_attribute e.g. &#033; is changed to &amp;#033; $oXml = new_xmldoc("1.0"); $oRoot = $oXml->add_root("outputXml"); $oRoot->set_attribute("test","&033;"); print $oXml->dumpmem(); This produces <?xml version="1.0"?> <outputXml test="&amp;033;"/> instead of <?xml version="1.0"?> <outputXml test="&033;"/> PHP modules compiled: './configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-config-file-path=/etc/httpd' '--with-regex=system' '--enable-debugger' '--enable-magic-quotes' '--enable-sysvshm' '--with-dom' '--enable-force-cgi-redirect' '--enable-sigchild' '--with-wddx' '--enable-inline-optimization' '--with-gnu-ld' '--enable-bcmath' '--enable-crypt' '--with-xml' '--with-sablot' '--enable-dbg=shared' '--with-dbg-profiler' ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14325&edit=1

« previous php.dev (#72403) next »