svn: /phpdoc/en/trunk/reference/dom/domdocument/ createelement.xml
| From: | Christoph Michael Becker | Date: | Tue, 21 Jun 2016 16:14:05 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/dom/domdocument/ createelement.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-14226@lists.php.net to get a copy of this message | ||
cmb Tue, 21 Jun 2016 16:14:05 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=339438
Log:
Fix #39521: DOMDocument::createElement() does not escape its parameters properly
Bug: https://bugs.php.net/39521 (Verified)
DOMDocument::createElement() does not escape its parameters properly
Changed paths:
U phpdoc/en/trunk/reference/dom/domdocument/createelement.xml
Modified: phpdoc/en/trunk/reference/dom/domdocument/createelement.xml
===================================================================
--- phpdoc/en/trunk/reference/dom/domdocument/createelement.xml 2016-06-21 15:03:43 UTC (rev 339437)
+++ phpdoc/en/trunk/reference/dom/domdocument/createelement.xml 2016-06-21 16:14:05 UTC (rev 339438)
@@ -37,6 +37,12 @@
The value can also be set later with <link
linkend="domnode.props.nodevalue">DOMElement::$nodeValue</link>.
</para>
+ <para>
+ The value is used verbatim except that the < and > entity
+ references will escaped. Note that & has to be manually escaped;
+ otherwise it is regarded as starting an entity reference. Also " won't be
+ escaped.
+ </para>
</listitem>
</varlistentry>
</variablelist>
@@ -93,6 +99,29 @@
</screen>
</example>
</para>
+ <para>
+ <example>
+ <title>Passing text containing an unescaped & as
<parameter>value</parameter></title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$dom = new DOMDocument('1.0', 'utf-8');
+$element = $dom->createElement('foo', 'me & you');
+$dom->appendChild($element);
+echo $dom->saveXML();
+?>
+]]>
+ </programlisting>
+ &example.outputs.similar;
+ <screen>
+<![CDATA[
+Warning: DOMDocument::createElement(): unterminated entity reference you in /in/BjTCg
on line 4
+<?xml version="1.0" encoding="utf-8"?>
+<foo/>
+]]>
+ </screen>
+ </example>
+ </para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;