mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-05 02:52:41 +00:00
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:
parent
44cf61b240
commit
06ee84a128
2 changed files with 14 additions and 6 deletions
|
@ -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')) . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 & 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="<>&"'" />';
|
||||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
/**
|
||||
* testToArray method
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue