0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-23 00:41:52 +00:00

Check if schema.ser was corrupted.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Edward Z. Yang 2010-10-29 14:47:40 +01:00
parent 4754d407aa
commit feeffe6ed2
2 changed files with 8 additions and 1 deletions

1
NEWS
View File

@ -17,6 +17,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
- Escape CDATA before removing Internet Explorer comments. - Escape CDATA before removing Internet Explorer comments.
- Fix removal of id attributes under certain conditions by ensuring - Fix removal of id attributes under certain conditions by ensuring
armor attributes are preserved when recreating tags. armor attributes are preserved when recreating tags.
- Check if schema.ser was corrupted.
4.2.0, released 2010-09-15 4.2.0, released 2010-09-15
! Added %Core.RemoveProcessingInstructions, which lets you remove ! Added %Core.RemoveProcessingInstructions, which lets you remove

View File

@ -60,7 +60,13 @@ class HTMLPurifier_ConfigSchema {
* Unserializes the default ConfigSchema. * Unserializes the default ConfigSchema.
*/ */
public static function makeFromSerial() { 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;
} }
/** /**