No Code Attached Yet bug
avatar CERGE-EI
CERGE-EI
11 Sep 2023

Steps to reproduce the issue

Joomla! 3, /libraries/src/Document/Renderer/Html/HeadRenderer.php:

			elseif ($type != 'http-equiv' && !empty($content))
			{
				if (is_array($content))
				{
					foreach ($content as $value)
					{
						$buffer .= $tab . '<meta ' . $type . '="' . $name . '" content="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" />' . $lnEnd;
					}
				}
				else
				{
					$buffer .= $tab . '<meta ' . $type . '="' . $name . '" content="' . htmlspecialchars($content, ENT_COMPAT, 'UTF-8') . '" />' . $lnEnd;
				}
			}

Joomla! 4, /libraries/src/Document/Renderer/Html/MetasRenderer.php:

            } elseif ($type !== 'http-equiv' && !empty($contents)) {
                $buffer .= $tab . '<meta ' . $type . '="' . $name . '" content="'
                    . htmlspecialchars($contents, ENT_COMPAT, 'UTF-8') . '">' . $lnEnd;
            }

the is_array() option was removed. We can restore it manually, but it is not a good idea to change Joomla! core on every update.

Expected result

JFactory::getDocument()->setMetaData($name, $value) accepts $value as an array and produces multiple META tags

Actual result

there is an error because htmlspecialchars() does not accept an array as its argument

System information (as much as possible)

Additional comments

As said above, we made a temporary fix via changing the core code, but we prefer not to do so.

avatar CERGE-EI CERGE-EI - open - 11 Sep 2023
avatar CERGE-EI CERGE-EI - change - 11 Sep 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 11 Sep 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Sep 2023
avatar Hackwar Hackwar - change - 28 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 28 Mar 2024

Add a Comment

Login with GitHub to post a comment