mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-01 09:02:38 +00:00
fixes #4976, escape chars in attributes of xml tags
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7253 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
013e9889e5
commit
38bbfb66ce
2 changed files with 14 additions and 1 deletions
|
@ -592,7 +592,7 @@ class XmlNode extends Object {
|
|||
if (is_array($this->attributes) && count($this->attributes) > 0) {
|
||||
foreach ($this->attributes as $key => $val) {
|
||||
$val = str_replace('"', '\"', $val);
|
||||
$d .= ' ' . $key . '="' . $val . '"';
|
||||
$d .= ' ' . $key . '="' . h($val) . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -542,5 +542,18 @@ class XmlTest extends UnitTestCase {
|
|||
$result = $xml->toString(array('cdata' => false));
|
||||
$this->assertEqual($expects, $result);
|
||||
}
|
||||
/**
|
||||
* testEscapeCharSerialization method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testEscapeCharSerialization() {
|
||||
$xml = new Xml(array('text' => 'JavaScript & DHTML'), array('attributes' => false, 'format' => 'attributes'));
|
||||
|
||||
$result = $xml->toString(false);
|
||||
$expected = '<std_class text="JavaScript & DHTML" />';
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue