:
0. CKFinder version is 2.1
1. Write an array to cookie
2. Open CKFinder, and click upload button
3. CKFinder popup a dialog says:
It was not possible to properly load the XML response from the web server.
XML Parsing Error: junk after document element Location: http://localhost:8080/js/ckfinder/ckfin ... angCode=en Line Number 2, Column 1:Warning: htmlspecialchars() expects parameter 1 to be string, array given in E:\xampp\htdocs\app\webroot\js\ckfinder\core\connector\php\php5\Utils\XmlNode.php on line 174
^
Raw response from the server:
<?xml version="1.0" encoding="utf-8"?><br />
<b>Warning</b>: htmlspecialchars() expects parameter 1 to be string, array given in <b>E:\xampp\htdocs\app\webroot\js\ckfinder\core\connector\php\php5\Utils\XmlNode.php</b> on line <b>174</b><br />
<Connector resourceType="Images"><Error number="0" /><CurrentFolder path="/" url="/upload/images/" acl="255" /><Cookies><Cookie name="CAKEPHP" value="4c583a36500d6b970f0e8d9d087b0de6" /><Cookie name="sdcms" value="" /></Cookies></Connector>
About The Code
:
print_r($_COOKIE);
printed message as below:
Array ( [CKFinder_Path] => Images:/:1 [CKFinder_Settings] => TNNDS [CAKEPHP] => 4c583a36500d6b970f0e8d9d087b0de6 [sdcms] => Array ( [User] => Array ( [locale] => Q2FrZQ==.rnAI ) ) )
You may see a cookie named sdcms has a value of array.
In file: ckfinder\core\connector\php\php5\CommandHandler\LoadCookies.php line:67
will pass the value to Ckfinder_Connector_Utils_XmlNode class.
in ckfinder\core\connector\php\php5\Utils\XmlNode.php line:174, will use the value. So PHP will write a warning: htmlspecialchars() expects parameter 1 to be string, but array was given.
That's a problem when convert a string to XML.
I add a line of code to fix this:
ckfinder\core\connector\php\php5\Utils\XmlNode.php line:170
foreach ($this->_attributes as $_name => $_value) {
if(is_array($_value)) continue;
$ret .= " " . $_name . '="' . $this->asUTF8(htmlspecialchars($_value)) . '"';
}
Re: BUG: When cookie has array, click upload failed
We will check this ASAP.
Re: BUG: When cookie has array, click upload failed
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+