Menu

#7 Title of image in posts and pages is 'Array'

open
nobody
None
5
2008-07-03
2008-07-03
littleram
No

If you add a gallery image to a blog post and then view the post, hover your mouse over the image and you will see the pop-up title say 'Array'.

This happens because the following call assumes that resp['photo']['title'] returns a string.

$title = $this->_unhtmlentities($resp['photo']['title']);

My quick solution is to add a small check at the start of _unhtmlentities() such that if the input parameter is an array then it will assume the string to be the first element in the array, i.e.:

function _unhtmlentities($string) {
if (is_array($string))
{
$string = reset($string);
}

// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);

...

Discussion


Log in to post a comment.

MongoDB Logo MongoDB