I have three messages in my System Events log this morning, all reporting the same error:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
PHP error debug
Error: urlencode() expects parameter 1 to be string, array given
Error type/ Nr.: Warning - 2
File: /mnt/gs02/herd02/25361/domains/idealog.co.nz/html/assets/snippets/jot/jot.class.inc.php.matt
Line: 858
Line 858 source: $urlstring[] = $name . '=' . urlencode($value);
(My version of jot.class.inc.php just includes the fixes from
http://modxcms.com/forums/index.php/topic,15746.0.html for displaying recent documents, which doesn’t seem related to this error. On the original Jot 1.1.2 file, the relevant line is 853.)
The code block in question looks like this:
$array_url = array_merge($array_get, $array_values);
foreach ($array_url as $name => $value) {
if (!is_null($value)) {
$urlstring[] = $name . '=' . urlencode($value);
}
}
For now, I have changed the line before the error occurs to
if (!is_null($value) && !is_array($value)) {
which should at least avoid the error. Does anybody know if there are circumstances in which an array might be correctly passed, and preserveUrl() should attempt to support?
(I’m noticing pretty steady traffic from spambots trying to break post comments, and I wouldn’t be surprised if these errors are coming from spambot requests, rather than from users.)