Bug #15257
closed
PHP5 breaks frontend when $TYPO3_CONF_VARS["FE"]["compressionLevel"] = 'TRUE';
Added by Torsten Schrade almost 19 years ago.
Updated over 18 years ago.
Description
When using PHP5 (5.0.4) the TYPO3 frontend just outputs <html><body></body></html> and nothing else if gzip compression is enabled and set to 'TURE' in localconf.php
Just use PHP5 and set $TYPO3_CONF_VARS["FE"]["compressionLevel"] = 'TRUE';
Apache issues a warnign about that in the logfiles:
[client 84.169.141.224] PHP Warning: gzcompress() expects parameter 2
to be long, string given in
/srv/www/typo3/typo3_src/typo3_src-3.8.1/t3lib/class.gzip_e
ncode.php on line 187
(issue imported from #M1976)
Files
I'll take care to fix this for 4.0
First I'll pin down summary of my examinations on this issue and try to get some feedback:
I guess the problem is that a Type-String 'true' in PHP4 was autoconverted to Type-Boolean so a conditional construct like 'if ($level === true)' would evaluate to (boolean)true.
PHP5 seems to leave the string as string and therefor the condition won't evaluate to true anymore.
However $level can be either an (int) [1-9] or a (boolean)[true/false]. Due to TYPO3s handling of config in localconf.php all of theses values will be assigned as String. So it will need some (little) brainwork how to handle this best, if we don't want to change behaviour on setting (int)1, which would behave the same as (string)'true' if we change to 'if ($level == true)'
The original upstream-class seems not to be activly maintained anymore by now?
http://www.leknor.com/code/php/view/class.gzip_encode.php.txt
Since we only have to deal with Strings (not Integers) this should work:
if (strtolower($level) 'true' || $level = true)
I'll submit a patch and afterwards close the bug.
I remember this problem to be occurring in Typo3 3.7 as well. Was the reason not to switch to PHP5 so far...
Comitted to HEAD, see patch
Also available in: Atom
PDF