diff --git a/NEWS b/NEWS index 7a2d4236..c028c486 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier - Escape CDATA before removing Internet Explorer comments. - Fix removal of id attributes under certain conditions by ensuring armor attributes are preserved when recreating tags. +- Check if schema.ser was corrupted. 4.2.0, released 2010-09-15 ! Added %Core.RemoveProcessingInstructions, which lets you remove diff --git a/library/HTMLPurifier/ConfigSchema.php b/library/HTMLPurifier/ConfigSchema.php index 67be5c71..fadf7a58 100644 --- a/library/HTMLPurifier/ConfigSchema.php +++ b/library/HTMLPurifier/ConfigSchema.php @@ -60,7 +60,13 @@ class HTMLPurifier_ConfigSchema { * Unserializes the default ConfigSchema. */ public static function makeFromSerial() { - return unserialize(file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema.ser')); + $contents = file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/ConfigSchema/schema.ser'); + $r = unserialize($contents); + if (!$r) { + $hash = sha1($contents); + trigger_error("Unserialization of configuration schema failed, sha1 of file was $hash", E_USER_ERROR); + } + return $r; } /**