[BUGFIX] Prevent TYPO3.settings in ajax requests 70/46070/2
authorNicole Cordes <typo3@cordes.co>
Mon, 18 Jan 2016 23:26:19 +0000 (00:26 +0100)
committerBenni Mack <benni@typo3.org>
Sat, 12 Mar 2016 17:09:08 +0000 (18:09 +0100)
Within ajax requests currently the ajaxUrls are exported to the
TYPO3.settings variable which overwrites the parent state with all
other information (e.g. format setting). This patch prevents the output
of new TYPO3.settings in the ajax response.

Resolves: #72606
Releases: 6.2
Change-Id: I0907be4564b6210b816eb607cd81156f987852d6
Reviewed-on: https://review.typo3.org/46070
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Stefan Froemken <froemken@gmail.com>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Classes/Page/PageRenderer.php

index 08a455a..32f6738 100644 (file)
@@ -2236,11 +2236,14 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                                $this->csConvObj->convArray($this->inlineSettings, $this->getCharSet(), 'utf-8');
                        }
                }
-               if (TYPO3_MODE === 'BE') {
-                       $this->addAjaxUrlsToInlineSettings();
+               $inlineSettings = '';
+               if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
+                       if (TYPO3_MODE === 'BE') {
+                               $this->addAjaxUrlsToInlineSettings();
+                       }
+                       $inlineSettings .= $this->inlineLanguageLabels ? 'TYPO3.lang = ' . json_encode($this->inlineLanguageLabels) . ';' : '';
+                       $inlineSettings .= $this->inlineSettings ? 'TYPO3.settings = ' . json_encode($this->inlineSettings) . ';' : '';
                }
-               $inlineSettings = $this->inlineLanguageLabels ? 'TYPO3.lang = ' . json_encode($this->inlineLanguageLabels) . ';' : '';
-               $inlineSettings .= $this->inlineSettings ? 'TYPO3.settings = ' . json_encode($this->inlineSettings) . ';' : '';
                if ($this->addExtCore || $this->addExtJS) {
                        // Set clear.gif, move it on top, add handler code
                        $code = '';