note 46962 deleted from function.base64-encode by philip
| From: | philip@php.net | Date: | Thu, 03 Sep 2015 02:30:14 +0000 |
| Subject: | note 46962 deleted from function.base64-encode by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203595@lists.php.net to get a copy of this message | ||
Note Submitter: mightymrj at hotmail dot com
----
Problem: mime attachments sending as blank or almost completely blank documents (all data is lost)
Explanation: After a couple days of trying to mime pdf attachments without losing all data, I
finally came across this function in some obsolete obscure post:
set_magic_quotes_runtime()
This is set to on by default in the machine, and it causes fread() and/or base64_encode() (both used
in most mime examples I've seen) to read or encrypt binary without slashes for special
characters. This causes sent files to process incorrectly, breaking, thus truncating most of the
data in the file.
Fix: pass 0 to this function and it will do a one time turn off while your code executes.
example:
<?php
set_magic_quotes_runtime(0);
?>
This can also been turned off in the php.ini file, but I'm not sure what uses that setting or
what the consequences might be.
info:
http://us2.php.net/manual/en/function.set-magic-quotes-runtime.php