ThumbnailSaver saveBase64AsImageFile fails if allow_url_fopen is disabled in PHP
-
Getting this error in
debug.log
[19-Jan-2025 15:49:49 UTC] PHP Warning: file_get_contents(): data:// wrapper is disabled in the server configuration by allow_url_fopen=0 in .../wp-content/plugins/mailpoet/lib/NewsletterTemplates/ThumbnailSaver.php on line 126
[19-Jan-2025 15:49:49 UTC] PHP Warning: file_get_contents(data:image/jpeg;base64,/9j/4AAQ…The
file_get_contents()
call inlib/NewsletterTemplates/ThumbnailSaver.php
fails if server hasallow_url_fopen=0
setting in PHP.Current code:
125: private function saveBase64AsImageFile(string $file, string $data): bool {
126: return file_put_contents($file, file_get_contents($data)) !== false;
127: }Suggested fix: Check
allow_url_fopen
before using this wrapper conversion hack. Also check result offile_get_contents()
which is missing in current code and which would point out the problem as well.Mailpoet 5.6.1, WordPress 6.4.5
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.