[TYPO3-core] RFC: #4379 - pageNotFound_handling ignores forceCharset setting

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Tue Nov 14 12:37:56 CET 2006


Michael Stucki schrieb:
> This is a SVN patch request.
> 
> Problem:
> If $TYPO3_CONF_VARS[FE][pageNotFound_handling] is triggered and pointing to
> an URL, TYPO3 ignores the setting of $TYPO3_CONF_VARS[BE][forceCharset ]
> and outputs a wrong charset in the header.
> 
> Solution:
> - Add support for multy-line $header parameter in
>   tslib_fe::pageNotFoundHandler()
> 
> - Fetch also the headers of the 404 document
> 
> - Forward only those headers that are specified in $forwardHeaders
>   (currently this is only the Content-Type which usually contains the
>   charset on the same line).
> 
> Branches: TYPO3_4-0 and Trunk

I think we can do better than fetching the same URL twice:

$content = t3lib_div::getURL($code, 0, $headerArr);
$header = t3lib_div::getURL($code, 2, $headerArr);

As the header is delimited by an empty line (\r\n is net line break) then 
it should work like this:

$url = t3lib_div::getURL($code, 1, $headerArr);
$n = strpos("\r\n\r\n", $url);
$header = substr($url,0,$n+2);
$header = substr($url,$n+4);

And the preg_quote is IMHO not necessary. A header may contain nothing that 
needs to be escaped.

Otherwise a +1 by looking at the code.

Masi



More information about the TYPO3-team-core mailing list