fixes #5429, Xml::toString() quotes

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7607 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-09-15 11:50:51 +00:00
parent 44cf61b240
commit 06ee84a128
2 changed files with 14 additions and 6 deletions

View file

@ -611,8 +611,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 . '="' . htmlspecialchars($val, ENT_NOQUOTES, Configure::read('App.encoding')) . '"';
$d .= ' ' . $key . '="' . htmlspecialchars($val, ENT_QUOTES, Configure::read('App.encoding')) . '"';
}
}
}

View file

@ -40,10 +40,6 @@ class XmlTest extends CakeTestCase {
$manager =& new XmlManager();
$manager->namespaces = array();
}
function KgetTests() {
return array('testRootTagParsing');
}
/**
* testRootTagParsing method
*
@ -673,6 +669,19 @@ class XmlTest extends CakeTestCase {
$expected = '<std_class text="JavaScript &amp; DHTML" />';
$this->assertEqual($expected, $result);
}
/**
* testCompleteEscapeCharSerialization method
*
* @access public
* @return void
*/
function testCompleteEscapeCharSerialization() {
$xml = new Xml(array('text' => '<>&"\''), array('attributes' => false, 'format' => 'attributes'));
$result = $xml->toString(false);
$expected = '<std_class text="&lt;&gt;&amp;&quot;&#039;" />';
$this->assertEqual($expected, $result);
}
/**
* testToArray method
*