Issue Bug Closed

#24277Double htmlspecialchars prevents load of google maps api

Saverio Vigni 12/02/10, 18:35 updated 12/03/10, 18:22

Description

While loading the google maps api with the following typoscript:

page.includeJS {
file0 = http://maps.google.com/maps?file=api&v=2&sensor=false&key=<google api key><br> file0.external = 1<br>}</google>

i found that for every ‘&’ in the url in the html source there where this string: ‘&amp;’, this means a double htmlspecialchars action.

In fact at line 727 of class.tslib_pagegen.php i found this:

htmlspecialchars($ss),

in $ss we have the external js to load, then this value is put into the js array.

Once the render method of the page renderer is called and the script tag is generated it passes thru anothe htmlspecialchars in line 1158 of class.t3lib_pagerenderer.php, so every ‘&’ of the original url becomes ‘&’ with the first htmlspecialchars call, then it becomes &amp; with the second.

This makes the google api prompt for an invalid key every time the api is loaded.

TESTED with google chrome

I’ve solved the problem removing the scond htmlspecialchars, but i don’t knw if there is a better way
(issue imported from #M16652)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.