PHP: warning: gzdecode(): data error & magic quotes
This blogpost is in English because I lost a few hours with this problem, and Google didn't show any good results, so I hope to help mankind by writing this in English ...
If you ever encounter the following error:
warning: gzdecode(): data error
when using the PHP gzdecode function, then please do yourself a favour, and check if you have magic_quotes_runtime
set to On
. If you do, set it to Off before you start recompiling php, libz, gzip, libjpeg or any other major lib or module.
magic_quotes_runtime
is evil and should never have been written. It seems the PHP community finally came to their senses, and removed it as of PHP 7.x. If enabled, it manipulates everything that PHP might see as a string, even blobs of binary that that happen to be assigned to a variable that might hold a string.
In short: do not ever use it, and if you get funky gzdecode() errors, check your php.ini
file.
Member discussion