Everything worked oki on development server but when I ported the site to live webserver => WSOD.
Because this module doesn't do at least an class_exists('DOMDocument', FALSE) the user doesn't have a clue of what happened... Also it is not very easy to debug especially when you also use PHPMailer module and other mail handling modules.
Here is the code responsible for the bug:
public function compress() {
error_reporting(0);
$doc = new DOMDocument('1.0', 'utf8');
So it sets to no error reporting and then tries to instantiate the class... And when that class doesn't exist everything crashes and no warning/error message are thrown to the developer.
What would be the best way to solve this issue ? I'm thinking that doing a class_exists and if the class doesn't exist return the html uncompressed would be a good idea. Also, a warning in 'admin/reports/status' would be very helpful to let the admin that even if the compress module is enabled it won't work until the php-xml library is installed.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | mimemail.535466_01.patch | 4.98 KB | sgabe |
| #1 | mimemail_compress.patch | 2.01 KB | andreiashu |
Comments
Comment #1
andreiashu commentedHere is a first patch that should solve this (annoying) issue. It simply skips the compress process if DOMDocument isn't available. It also adds an OKI or ERROR message type at 'admin/reports/status' depending on the availability of the class.
The messages/warnings need improvements.
Setting this as CNR so I can get some feedback.
Comment #2
andreiashu commentedSetting this as 'needs work' because we should provide a .install file that doesn't let the user enable this module without having the php-xml extension in the first place.
And a better title.
Comment #3
sgabe commentedThe attached patch is against current HEAD and provides an install file with
hook_requirement()which checks for the DOM extension.Comment #4
sgabe commentedCommitted to HEAD.
Comment #5
andreiashu commentedcool! Thanks
Comment #7
alar commentedI'm only 'staging' a migration. My solution today is to disable Mime Mail CSS Compressor 6.x-1.1 entirely.
All is happy in my world again, but I log this in fear it comes back to haunt me! ;)