From 8ab30e24b747cef9ecdbb46bdc14fc10e60629f4 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Fri, 23 May 2008 16:43:24 +0000 Subject: [PATCH] [3.1.1] Memory optimizations for ConfigSchema. Changes include: - Elimination of ConfigDef and subclasses in favor of stdclass. Most property names stay the same - Added benchmark script for ConfigSchema - Types are internally handled as magic integers. Use HTMLPurifier_VarParser->getTypeName to convert to human readable form. HTMLPurifier_VarParser still accepts strings. - Parser in config schema only used for legacy interface git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1764 48356398-32a2-884e-a903-53898d9a118a --- NEWS | 6 ++ TODO | 2 - benchmarks/ConfigSchema.php | 4 + library/HTMLPurifier.includes.php | 4 - library/HTMLPurifier.safe-includes.php | 4 - library/HTMLPurifier/Config.php | 14 ++-- library/HTMLPurifier/ConfigDef.php | 9 --- library/HTMLPurifier/ConfigDef/Directive.php | 55 ------------- library/HTMLPurifier/ConfigDef/DirectiveAlias.php | 24 ------ library/HTMLPurifier/ConfigDef/Namespace.php | 10 --- library/HTMLPurifier/ConfigSchema.php | 56 ++++++++----- library/HTMLPurifier/ConfigSchema/Validator.php | 3 +- library/HTMLPurifier/ConfigSchema/schema.ser | 2 +- library/HTMLPurifier/VarParser.php | 95 +++++++++++++++-------- library/HTMLPurifier/VarParser/Flexible.php | 30 +++---- tests/HTMLPurifier/ConfigSchemaTest.php | 57 ++++++-------- tests/HTMLPurifier/SimpleTest/Reporter.php | 8 ++ tests/HTMLPurifier/VarParser/FlexibleTest.php | 6 +- 18 files changed, 171 insertions(+), 218 deletions(-) delete mode 100644 library/HTMLPurifier/ConfigDef.php delete mode 100644 library/HTMLPurifier/ConfigDef/Directive.php delete mode 100644 library/HTMLPurifier/ConfigDef/DirectiveAlias.php delete mode 100644 library/HTMLPurifier/ConfigDef/Namespace.php rewrite library/HTMLPurifier/ConfigSchema/schema.ser (83%) diff --git a/NEWS b/NEWS index f109e910..28688fd3 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,12 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier will still work--the new format, however, lets modules access the configuration object for HTML namespace dependant tweaks. . AttrDef_HTML_Pixels now takes a single construction parameter, pixels. +. ConfigSchema data-structure heavily optimized; on average it uses half + the memory it did previously. The interface has changed accordingly, + consult changes to HTMLPurifier_Config for details. +. Variable parsing types now are magic integers instead of strings +. Added benchmark for ConfigSchema + 3.1.0, released 2008-05-18 # Unnecessary references to objects (vestiges of PHP4) removed from method diff --git a/TODO b/TODO index 96bd20f0..b26aafcd 100644 --- a/TODO +++ b/TODO @@ -11,8 +11,6 @@ If no interest is expressed for a feature that may require a considerable amount of effort to implement, it may get endlessly delayed. Do not be afraid to cast your vote for the next feature to be implemented! -- Ability to fully turn off imagecrash fixes (attribute and CSS will require - two separate directives due to our architecture.) - Investigate how early internal structures can be accessed; this would prevent structures from being parsed and serialized multiple times. - Figure out how to simultaneously set %CSS.Trusted and %HTML.Trusted (?) diff --git a/benchmarks/ConfigSchema.php b/benchmarks/ConfigSchema.php index a8c7cef7..4e140faf 100644 --- a/benchmarks/ConfigSchema.php +++ b/benchmarks/ConfigSchema.php @@ -1,5 +1,9 @@ def->info[$namespace][$key]->class == 'alias') { + if (isset($this->def->info[$namespace][$key]->isAlias)) { $d = $this->def->info[$namespace][$key]; trigger_error('Cannot get value from aliased directive, use real name ' . $d->namespace . '.' . $d->name, E_USER_ERROR); @@ -196,7 +196,7 @@ class HTMLPurifier_Config E_USER_WARNING); return; } - if ($this->def->info[$namespace][$key]->class == 'alias') { + if (isset($this->def->info[$namespace][$key]->isAlias)) { if ($from_alias) { trigger_error('Double-aliases not allowed, please fix '. 'ConfigSchema bug with' . "$namespace.$key", E_USER_ERROR); @@ -212,10 +212,10 @@ class HTMLPurifier_Config $value = $this->parser->parse( $value, $type = $this->def->info[$namespace][$key]->type, - $this->def->info[$namespace][$key]->allow_null + isset($this->def->info[$namespace][$key]->allow_null) ); } catch (HTMLPurifier_VarParserException $e) { - trigger_error('Value for ' . "$namespace.$key" . ' is of invalid type, should be ' . $type, E_USER_WARNING); + trigger_error('Value for ' . "$namespace.$key" . ' is of invalid type, should be ' . HTMLPurifier_VarParser::getTypeName($type), E_USER_WARNING); return; } if (is_string($value)) { @@ -223,9 +223,9 @@ class HTMLPurifier_Config if (isset($this->def->info[$namespace][$key]->aliases[$value])) { $value = $this->def->info[$namespace][$key]->aliases[$value]; } - if ($this->def->info[$namespace][$key]->allowed !== true) { + if (isset($this->def->info[$namespace][$key])) { // check to see if the value is allowed - if (!isset($this->def->info[$namespace][$key]->allowed[$value])) { + if (isset($this->def->info[$namespace][$key]->allowed) && !isset($this->def->info[$namespace][$key]->allowed[$value])) { trigger_error('Value not supported, valid values are: ' . $this->_listify($this->def->info[$namespace][$key]->allowed), E_USER_WARNING); return; @@ -386,7 +386,7 @@ class HTMLPurifier_Config if (isset($blacklisted_directives["$ns.$directive"])) continue; if (!isset($allowed_directives["$ns.$directive"]) && !isset($allowed_ns[$ns])) continue; } - if ($def->class == 'alias') continue; + if (isset($def->isAlias)) continue; if ($directive == 'DefinitionID' || $directive == 'DefinitionRev') continue; $ret[] = array($ns, $directive); } diff --git a/library/HTMLPurifier/ConfigDef.php b/library/HTMLPurifier/ConfigDef.php deleted file mode 100644 index fe35e7a6..00000000 --- a/library/HTMLPurifier/ConfigDef.php +++ /dev/null @@ -1,9 +0,0 @@ -type = $type; - if ( $allow_null !== null) $this->allow_null = $allow_null; - if ( $allowed !== null) $this->allowed = $allowed; - if ( $aliases !== null) $this->aliases = $aliases; - } - - /** - * Allowed type of the directive. Values are: - * - string - * - istring (case insensitive string) - * - int - * - float - * - bool - * - lookup (array of value => true) - * - list (regular numbered index array) - * - hash (array of key => value) - * - mixed (anything goes) - */ - public $type = 'mixed'; - - /** - * Is null allowed? Has no effect for mixed type. - * @bool - */ - public $allow_null = false; - - /** - * Lookup table of allowed values of the element, bool true if all allowed. - */ - public $allowed = true; - - /** - * Hash of value aliases, i.e. values that are equivalent. - */ - public $aliases = array(); - -} - diff --git a/library/HTMLPurifier/ConfigDef/DirectiveAlias.php b/library/HTMLPurifier/ConfigDef/DirectiveAlias.php deleted file mode 100644 index 98b8edd1..00000000 --- a/library/HTMLPurifier/ConfigDef/DirectiveAlias.php +++ /dev/null @@ -1,24 +0,0 @@ -namespace = $namespace; - $this->name = $name; - } -} - diff --git a/library/HTMLPurifier/ConfigDef/Namespace.php b/library/HTMLPurifier/ConfigDef/Namespace.php deleted file mode 100644 index f282065b..00000000 --- a/library/HTMLPurifier/ConfigDef/Namespace.php +++ /dev/null @@ -1,10 +0,0 @@ - array( + * 'Directive' => new stdclass(), + * ) + * ) + * + * The stdclass may have the following properties: + * + * - If isAlias isn't set: + * - type: Integer type of directive, see HTMLPurifier_VarParser for definitions + * - allow_null: If set, this directive allows null values + * - aliases: If set, an associative array of value aliases to real values + * - allowed: If set, a lookup array of allowed (string) values + * - If isAlias is set: + * - namespace: Namespace this directive aliases to + * - name: Directive name this directive aliases to + * + * This class is friendly with HTMLPurifier_Config. If you need introspection + * about the schema, you're better of using the ConfigSchema_Interchange, + * which uses more memory but has much richer information. */ public $info = array(); @@ -22,15 +43,6 @@ class HTMLPurifier_ConfigSchema { static protected $singleton; /** - * Variable parser. - */ - protected $parser; - - public function __construct() { - $this->parser = new HTMLPurifier_VarParser_Flexible(); - } - - /** * Unserializes the default ConfigSchema. */ public static function makeFromSerial() { @@ -62,11 +74,11 @@ class HTMLPurifier_ConfigSchema { * @param $allow_null Whether or not to allow null values */ public function add($namespace, $name, $default, $type, $allow_null) { - $default = $this->parser->parse($default, $type, $allow_null); - $this->info[$namespace][$name] = new HTMLPurifier_ConfigDef_Directive(); - $this->info[$namespace][$name]->type = $type; - $this->info[$namespace][$name]->allow_null = $allow_null; - $this->defaults[$namespace][$name] = $default; + $obj = new stdclass(); + $obj->type = is_int($type) ? $type : HTMLPurifier_VarParser::$types[$type]; + if ($allow_null) $obj->allow_null = true; + $this->info[$namespace][$name] = $obj; + $this->defaults[$namespace][$name] = $default; } /** @@ -90,6 +102,9 @@ class HTMLPurifier_ConfigSchema { * @param $aliases Hash of aliased values to the real alias */ public function addValueAliases($namespace, $name, $aliases) { + if (!isset($this->info[$namespace][$name]->aliases)) { + $this->info[$namespace][$name]->aliases = array(); + } foreach ($aliases as $alias => $real) { $this->info[$namespace][$name]->aliases[$alias] = $real; } @@ -104,7 +119,6 @@ class HTMLPurifier_ConfigSchema { * @param $allowed Lookup array of allowed values */ public function addAllowedValues($namespace, $name, $allowed) { - $type = $this->info[$namespace][$name]->type; $this->info[$namespace][$name]->allowed = $allowed; } @@ -116,7 +130,11 @@ class HTMLPurifier_ConfigSchema { * @param $new_name Directive that the alias will be to */ public function addAlias($namespace, $name, $new_namespace, $new_name) { - $this->info[$namespace][$name] = new HTMLPurifier_ConfigDef_DirectiveAlias($new_namespace, $new_name); + $obj = new stdclass; + $obj->namespace = $new_namespace; + $obj->name = $new_name; + $obj->isAlias = true; + $this->info[$namespace][$name] = $obj; } // DEPRECATED METHODS @@ -124,7 +142,6 @@ class HTMLPurifier_ConfigSchema { /** @see HTMLPurifier_ConfigSchema->set() */ public static function define($namespace, $name, $default, $type, $description) { HTMLPurifier_ConfigSchema::deprecated(__METHOD__); - // process modifiers (OPTIMIZE!) $type_values = explode('/', $type, 2); $type = $type_values[0]; $modifier = isset($type_values[1]) ? $type_values[1] : false; @@ -168,7 +185,8 @@ class HTMLPurifier_ConfigSchema { /** @deprecated, use HTMLPurifier_VarParser->parse() */ public function validate($a, $b, $c = false) { trigger_error("HTMLPurifier_ConfigSchema->validate deprecated, use HTMLPurifier_VarParser->parse instead", E_USER_NOTICE); - return $this->parser->parse($a, $b, $c); + $parser = new HTMLPurifier_VarParser(); + return $parser->parse($a, $b, $c); } /** diff --git a/library/HTMLPurifier/ConfigSchema/Validator.php b/library/HTMLPurifier/ConfigSchema/Validator.php index e36ef8f1..64a35430 100644 --- a/library/HTMLPurifier/ConfigSchema/Validator.php +++ b/library/HTMLPurifier/ConfigSchema/Validator.php @@ -111,7 +111,8 @@ class HTMLPurifier_ConfigSchema_Validator if (!is_null($d->allowed) || !empty($d->valueAliases)) { // allowed and valueAliases require that we be dealing with // strings, so check for that early. - if (!isset(HTMLPurifier_VarParser::$stringTypes[$d->type])) { + $d_int = HTMLPurifier_VarParser::$types[$d->type]; + if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) { $this->error('type', 'must be a string type when used with allowed or value aliases'); } } diff --git a/library/HTMLPurifier/ConfigSchema/schema.ser b/library/HTMLPurifier/ConfigSchema/schema.ser dissimilarity index 83% index 9469b980..964df3c4 100644 --- a/library/HTMLPurifier/ConfigSchema/schema.ser +++ b/library/HTMLPurifier/ConfigSchema/schema.ser @@ -1 +1 @@ -O:25:"HTMLPurifier_ConfigSchema":3:{s:8:"defaults";a:12:{s:4:"Attr";a:11:{s:19:"AllowedFrameTargets";a:0:{}s:10:"AllowedRel";a:0:{}s:10:"AllowedRev";a:0:{}s:19:"DefaultInvalidImage";s:0:"";s:22:"DefaultInvalidImageAlt";s:13:"Invalid image";s:14:"DefaultTextDir";s:3:"ltr";s:8:"EnableID";b:0;s:11:"IDBlacklist";a:0:{}s:17:"IDBlacklistRegexp";N;s:8:"IDPrefix";s:0:"";s:13:"IDPrefixLocal";s:0:"";}s:10:"AutoFormat";a:4:{s:13:"AutoParagraph";b:0;s:6:"Custom";a:0:{}s:7:"Linkify";b:0;s:15:"PurifierLinkify";b:0;}s:15:"AutoFormatParam";a:1:{s:21:"PurifierLinkifyDocURL";s:3:"#%s";}s:3:"CSS";a:6:{s:14:"AllowImportant";b:0;s:11:"AllowTricky";b:0;s:17:"AllowedProperties";N;s:13:"DefinitionRev";i:1;s:12:"MaxImgLength";s:6:"1200px";s:11:"Proprietary";b:0;}s:5:"Cache";a:2:{s:14:"DefinitionImpl";s:10:"Serializer";s:14:"SerializerPath";N;}s:4:"Core";a:15:{s:17:"AggressivelyFixLt";b:0;s:13:"CollectErrors";b:0;s:13:"ColorKeywords";a:17:{s:6:"maroon";s:7:"#800000";s:3:"red";s:7:"#FF0000";s:6:"orange";s:7:"#FFA500";s:6:"yellow";s:7:"#FFFF00";s:5:"olive";s:7:"#808000";s:6:"purple";s:7:"#800080";s:7:"fuchsia";s:7:"#FF00FF";s:5:"white";s:7:"#FFFFFF";s:4:"lime";s:7:"#00FF00";s:5:"green";s:7:"#008000";s:4:"navy";s:7:"#000080";s:4:"blue";s:7:"#0000FF";s:4:"aqua";s:7:"#00FFFF";s:4:"teal";s:7:"#008080";s:5:"black";s:7:"#000000";s:6:"silver";s:7:"#C0C0C0";s:4:"gray";s:7:"#808080";}s:25:"ConvertDocumentToFragment";b:1;s:31:"DirectLexLineNumberSyncInterval";i:0;s:8:"Encoding";s:5:"utf-8";s:21:"EscapeInvalidChildren";b:0;s:17:"EscapeInvalidTags";b:0;s:24:"EscapeNonASCIICharacters";b:0;s:14:"HiddenElements";a:2:{s:6:"script";b:1;s:5:"style";b:1;}s:8:"Language";s:2:"en";s:9:"LexerImpl";N;s:19:"MaintainLineNumbers";N;s:16:"RemoveInvalidImg";b:1;s:20:"RemoveScriptContents";N;}s:6:"Filter";a:3:{s:6:"Custom";a:0:{}s:18:"ExtractStyleBlocks";b:0;s:7:"YouTube";b:0;}s:11:"FilterParam";a:3:{s:26:"ExtractStyleBlocksEscaping";b:1;s:23:"ExtractStyleBlocksScope";N;s:26:"ExtractStyleBlocksTidyImpl";N;}s:4:"HTML";a:21:{s:7:"Allowed";N;s:17:"AllowedAttributes";N;s:15:"AllowedElements";N;s:14:"AllowedModules";N;s:12:"BlockWrapper";s:1:"p";s:11:"CoreModules";a:7:{s:9:"Structure";b:1;s:4:"Text";b:1;s:9:"Hypertext";b:1;s:4:"List";b:1;s:22:"NonXMLCommonAttributes";b:1;s:19:"XMLCommonAttributes";b:1;s:16:"CommonAttributes";b:1;}s:13:"CustomDoctype";N;s:12:"DefinitionID";N;s:13:"DefinitionRev";i:1;s:7:"Doctype";N;s:19:"ForbiddenAttributes";a:0:{}s:17:"ForbiddenElements";a:0:{}s:12:"MaxImgLength";i:1200;s:6:"Parent";s:3:"div";s:11:"Proprietary";b:0;s:6:"Strict";b:0;s:7:"TidyAdd";a:0:{}s:9:"TidyLevel";s:6:"medium";s:10:"TidyRemove";a:0:{}s:7:"Trusted";b:0;s:5:"XHTML";b:1;}s:6:"Output";a:3:{s:21:"CommentScriptContents";b:1;s:7:"Newline";N;s:10:"TidyFormat";b:0;}s:4:"Test";a:1:{s:12:"ForceNoIconv";b:0;}s:3:"URI";a:14:{s:14:"AllowedSchemes";a:6:{s:4:"http";b:1;s:5:"https";b:1;s:6:"mailto";b:1;s:3:"ftp";b:1;s:4:"nntp";b:1;s:4:"news";b:1;}s:4:"Base";N;s:13:"DefaultScheme";s:4:"http";s:12:"DefinitionID";N;s:13:"DefinitionRev";i:1;s:7:"Disable";b:0;s:15:"DisableExternal";b:0;s:24:"DisableExternalResources";b:0;s:16:"DisableResources";b:0;s:4:"Host";N;s:13:"HostBlacklist";a:0:{}s:12:"MakeAbsolute";b:0;s:5:"Munge";N;s:22:"OverrideAllowedSchemes";b:1;}}s:4:"info";a:12:{s:4:"Attr";a:12:{s:19:"AllowedFrameTargets";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:10:"AllowedRel";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:10:"AllowedRev";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:19:"DefaultInvalidImage";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:22:"DefaultInvalidImageAlt";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:14:"DefaultTextDir";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";a:2:{s:3:"ltr";b:1;s:3:"rtl";b:1;}s:7:"aliases";a:0:{}}s:8:"EnableID";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:11:"IDBlacklist";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"list";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:17:"IDBlacklistRegexp";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:8:"IDPrefix";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"IDPrefixLocal";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:10:"DisableURI";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:3:"URI";s:4:"name";s:7:"Disable";}}s:10:"AutoFormat";a:4:{s:13:"AutoParagraph";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:6:"Custom";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"list";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:7:"Linkify";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:15:"PurifierLinkify";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}s:15:"AutoFormatParam";a:1:{s:21:"PurifierLinkifyDocURL";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}s:3:"CSS";a:6:{s:14:"AllowImportant";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:11:"AllowTricky";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:17:"AllowedProperties";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"DefinitionRev";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:3:"int";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:12:"MaxImgLength";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:11:"Proprietary";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}s:5:"Cache";a:2:{s:14:"DefinitionImpl";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:14:"SerializerPath";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}s:4:"Core";a:20:{s:15:"DefinitionCache";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:5:"Cache";s:4:"name";s:14:"DefinitionImpl";}s:17:"AggressivelyFixLt";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"CollectErrors";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"ColorKeywords";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"hash";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:25:"ConvertDocumentToFragment";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:19:"AcceptFullDocuments";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:4:"Core";s:4:"name";s:25:"ConvertDocumentToFragment";}s:31:"DirectLexLineNumberSyncInterval";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:3:"int";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:8:"Encoding";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:7:"istring";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:21:"EscapeInvalidChildren";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:17:"EscapeInvalidTags";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:24:"EscapeNonASCIICharacters";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:14:"HiddenElements";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:8:"Language";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:9:"LexerImpl";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:5:"mixed";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:19:"MaintainLineNumbers";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:16:"RemoveInvalidImg";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:20:"RemoveScriptContents";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:5:"XHTML";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:4:"HTML";s:4:"name";s:5:"XHTML";}s:21:"CommentScriptContents";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:6:"Output";s:4:"name";s:21:"CommentScriptContents";}s:10:"TidyFormat";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:6:"Output";s:4:"name";s:10:"TidyFormat";}}s:6:"Filter";a:5:{s:6:"Custom";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"list";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:18:"ExtractStyleBlocks";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:7:"YouTube";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:26:"ExtractStyleBlocksEscaping";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:11:"FilterParam";s:4:"name";s:26:"ExtractStyleBlocksEscaping";}s:23:"ExtractStyleBlocksScope";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:11:"FilterParam";s:4:"name";s:23:"ExtractStyleBlocksScope";}}s:11:"FilterParam";a:3:{s:26:"ExtractStyleBlocksEscaping";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:23:"ExtractStyleBlocksScope";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:26:"ExtractStyleBlocksTidyImpl";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:5:"mixed";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}s:4:"HTML";a:22:{s:12:"EnableAttrID";O:37:"HTMLPurifier_ConfigDef_DirectiveAlias":3:{s:5:"class";s:5:"alias";s:9:"namespace";s:4:"Attr";s:4:"name";s:8:"EnableID";}s:7:"Allowed";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:5:"itext";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:17:"AllowedAttributes";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:15:"AllowedElements";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:14:"AllowedModules";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:12:"BlockWrapper";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:11:"CoreModules";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"CustomDoctype";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:12:"DefinitionID";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"DefinitionRev";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:3:"int";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:7:"Doctype";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";a:5:{s:22:"HTML 4.01 Transitional";b:1;s:16:"HTML 4.01 Strict";b:1;s:22:"XHTML 1.0 Transitional";b:1;s:16:"XHTML 1.0 Strict";b:1;s:9:"XHTML 1.1";b:1;}s:7:"aliases";a:0:{}}s:19:"ForbiddenAttributes";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:17:"ForbiddenElements";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:12:"MaxImgLength";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:3:"int";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:6:"Parent";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:11:"Proprietary";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:6:"Strict";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:7:"TidyAdd";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:9:"TidyLevel";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";a:4:{s:4:"none";b:1;s:5:"light";b:1;s:6:"medium";b:1;s:5:"heavy";b:1;}s:7:"aliases";a:0:{}}s:10:"TidyRemove";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:7:"Trusted";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:5:"XHTML";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}s:6:"Output";a:3:{s:21:"CommentScriptContents";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:7:"Newline";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:10:"TidyFormat";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}s:4:"Test";a:1:{s:12:"ForceNoIconv";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}s:3:"URI";a:14:{s:14:"AllowedSchemes";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"lookup";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:4:"Base";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"DefaultScheme";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:12:"DefinitionID";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"DefinitionRev";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:3:"int";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:7:"Disable";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:15:"DisableExternal";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:24:"DisableExternalResources";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:16:"DisableResources";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:4:"Host";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:13:"HostBlacklist";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"list";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:12:"MakeAbsolute";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:5:"Munge";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:6:"string";s:10:"allow_null";b:1;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}s:22:"OverrideAllowedSchemes";O:32:"HTMLPurifier_ConfigDef_Directive":5:{s:5:"class";s:9:"directive";s:4:"type";s:4:"bool";s:10:"allow_null";b:0;s:7:"allowed";b:1;s:7:"aliases";a:0:{}}}}s:9:"*parser";O:31:"HTMLPurifier_VarParser_Flexible":0:{}} \ No newline at end of file +O:25:"HTMLPurifier_ConfigSchema":2:{s:8:"defaults";a:12:{s:4:"Attr";a:11:{s:19:"AllowedFrameTargets";a:0:{}s:10:"AllowedRel";a:0:{}s:10:"AllowedRev";a:0:{}s:19:"DefaultInvalidImage";s:0:"";s:22:"DefaultInvalidImageAlt";s:13:"Invalid image";s:14:"DefaultTextDir";s:3:"ltr";s:8:"EnableID";b:0;s:11:"IDBlacklist";a:0:{}s:17:"IDBlacklistRegexp";N;s:8:"IDPrefix";s:0:"";s:13:"IDPrefixLocal";s:0:"";}s:10:"AutoFormat";a:4:{s:13:"AutoParagraph";b:0;s:6:"Custom";a:0:{}s:7:"Linkify";b:0;s:15:"PurifierLinkify";b:0;}s:15:"AutoFormatParam";a:1:{s:21:"PurifierLinkifyDocURL";s:3:"#%s";}s:3:"CSS";a:6:{s:14:"AllowImportant";b:0;s:11:"AllowTricky";b:0;s:17:"AllowedProperties";N;s:13:"DefinitionRev";i:1;s:12:"MaxImgLength";s:6:"1200px";s:11:"Proprietary";b:0;}s:5:"Cache";a:2:{s:14:"DefinitionImpl";s:10:"Serializer";s:14:"SerializerPath";N;}s:4:"Core";a:15:{s:17:"AggressivelyFixLt";b:0;s:13:"CollectErrors";b:0;s:13:"ColorKeywords";a:17:{s:6:"maroon";s:7:"#800000";s:3:"red";s:7:"#FF0000";s:6:"orange";s:7:"#FFA500";s:6:"yellow";s:7:"#FFFF00";s:5:"olive";s:7:"#808000";s:6:"purple";s:7:"#800080";s:7:"fuchsia";s:7:"#FF00FF";s:5:"white";s:7:"#FFFFFF";s:4:"lime";s:7:"#00FF00";s:5:"green";s:7:"#008000";s:4:"navy";s:7:"#000080";s:4:"blue";s:7:"#0000FF";s:4:"aqua";s:7:"#00FFFF";s:4:"teal";s:7:"#008080";s:5:"black";s:7:"#000000";s:6:"silver";s:7:"#C0C0C0";s:4:"gray";s:7:"#808080";}s:25:"ConvertDocumentToFragment";b:1;s:31:"DirectLexLineNumberSyncInterval";i:0;s:8:"Encoding";s:5:"utf-8";s:21:"EscapeInvalidChildren";b:0;s:17:"EscapeInvalidTags";b:0;s:24:"EscapeNonASCIICharacters";b:0;s:14:"HiddenElements";a:2:{s:6:"script";b:1;s:5:"style";b:1;}s:8:"Language";s:2:"en";s:9:"LexerImpl";N;s:19:"MaintainLineNumbers";N;s:16:"RemoveInvalidImg";b:1;s:20:"RemoveScriptContents";N;}s:6:"Filter";a:3:{s:6:"Custom";a:0:{}s:18:"ExtractStyleBlocks";b:0;s:7:"YouTube";b:0;}s:11:"FilterParam";a:3:{s:26:"ExtractStyleBlocksEscaping";b:1;s:23:"ExtractStyleBlocksScope";N;s:26:"ExtractStyleBlocksTidyImpl";N;}s:4:"HTML";a:21:{s:7:"Allowed";N;s:17:"AllowedAttributes";N;s:15:"AllowedElements";N;s:14:"AllowedModules";N;s:12:"BlockWrapper";s:1:"p";s:11:"CoreModules";a:7:{s:9:"Structure";b:1;s:4:"Text";b:1;s:9:"Hypertext";b:1;s:4:"List";b:1;s:22:"NonXMLCommonAttributes";b:1;s:19:"XMLCommonAttributes";b:1;s:16:"CommonAttributes";b:1;}s:13:"CustomDoctype";N;s:12:"DefinitionID";N;s:13:"DefinitionRev";i:1;s:7:"Doctype";N;s:19:"ForbiddenAttributes";a:0:{}s:17:"ForbiddenElements";a:0:{}s:12:"MaxImgLength";i:1200;s:6:"Parent";s:3:"div";s:11:"Proprietary";b:0;s:6:"Strict";b:0;s:7:"TidyAdd";a:0:{}s:9:"TidyLevel";s:6:"medium";s:10:"TidyRemove";a:0:{}s:7:"Trusted";b:0;s:5:"XHTML";b:1;}s:6:"Output";a:3:{s:21:"CommentScriptContents";b:1;s:7:"Newline";N;s:10:"TidyFormat";b:0;}s:4:"Test";a:1:{s:12:"ForceNoIconv";b:0;}s:3:"URI";a:14:{s:14:"AllowedSchemes";a:6:{s:4:"http";b:1;s:5:"https";b:1;s:6:"mailto";b:1;s:3:"ftp";b:1;s:4:"nntp";b:1;s:4:"news";b:1;}s:4:"Base";N;s:13:"DefaultScheme";s:4:"http";s:12:"DefinitionID";N;s:13:"DefinitionRev";i:1;s:7:"Disable";b:0;s:15:"DisableExternal";b:0;s:24:"DisableExternalResources";b:0;s:16:"DisableResources";b:0;s:4:"Host";N;s:13:"HostBlacklist";a:0:{}s:12:"MakeAbsolute";b:0;s:5:"Munge";N;s:22:"OverrideAllowedSchemes";b:1;}}s:4:"info";a:12:{s:4:"Attr";a:12:{s:19:"AllowedFrameTargets";O:8:"stdClass":1:{s:4:"type";i:7;}s:10:"AllowedRel";O:8:"stdClass":1:{s:4:"type";i:7;}s:10:"AllowedRev";O:8:"stdClass":1:{s:4:"type";i:7;}s:19:"DefaultInvalidImage";O:8:"stdClass":1:{s:4:"type";i:0;}s:22:"DefaultInvalidImageAlt";O:8:"stdClass":1:{s:4:"type";i:0;}s:14:"DefaultTextDir";O:8:"stdClass":2:{s:4:"type";i:0;s:7:"allowed";a:2:{s:3:"ltr";b:1;s:3:"rtl";b:1;}}s:8:"EnableID";O:8:"stdClass":1:{s:4:"type";i:6;}s:11:"IDBlacklist";O:8:"stdClass":1:{s:4:"type";i:8;}s:17:"IDBlacklistRegexp";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:8:"IDPrefix";O:8:"stdClass":1:{s:4:"type";i:0;}s:13:"IDPrefixLocal";O:8:"stdClass":1:{s:4:"type";i:0;}s:10:"DisableURI";O:8:"stdClass":3:{s:9:"namespace";s:3:"URI";s:4:"name";s:7:"Disable";s:7:"isAlias";b:1;}}s:10:"AutoFormat";a:4:{s:13:"AutoParagraph";O:8:"stdClass":1:{s:4:"type";i:6;}s:6:"Custom";O:8:"stdClass":1:{s:4:"type";i:8;}s:7:"Linkify";O:8:"stdClass":1:{s:4:"type";i:6;}s:15:"PurifierLinkify";O:8:"stdClass":1:{s:4:"type";i:6;}}s:15:"AutoFormatParam";a:1:{s:21:"PurifierLinkifyDocURL";O:8:"stdClass":1:{s:4:"type";i:0;}}s:3:"CSS";a:6:{s:14:"AllowImportant";O:8:"stdClass":1:{s:4:"type";i:6;}s:11:"AllowTricky";O:8:"stdClass":1:{s:4:"type";i:6;}s:17:"AllowedProperties";O:8:"stdClass":2:{s:4:"type";i:7;s:10:"allow_null";b:1;}s:13:"DefinitionRev";O:8:"stdClass":1:{s:4:"type";i:4;}s:12:"MaxImgLength";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:11:"Proprietary";O:8:"stdClass":1:{s:4:"type";i:6;}}s:5:"Cache";a:2:{s:14:"DefinitionImpl";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:14:"SerializerPath";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}}s:4:"Core";a:20:{s:15:"DefinitionCache";O:8:"stdClass":3:{s:9:"namespace";s:5:"Cache";s:4:"name";s:14:"DefinitionImpl";s:7:"isAlias";b:1;}s:17:"AggressivelyFixLt";O:8:"stdClass":1:{s:4:"type";i:6;}s:13:"CollectErrors";O:8:"stdClass":1:{s:4:"type";i:6;}s:13:"ColorKeywords";O:8:"stdClass":1:{s:4:"type";i:9;}s:25:"ConvertDocumentToFragment";O:8:"stdClass":1:{s:4:"type";i:6;}s:19:"AcceptFullDocuments";O:8:"stdClass":3:{s:9:"namespace";s:4:"Core";s:4:"name";s:25:"ConvertDocumentToFragment";s:7:"isAlias";b:1;}s:31:"DirectLexLineNumberSyncInterval";O:8:"stdClass":1:{s:4:"type";i:4;}s:8:"Encoding";O:8:"stdClass":1:{s:4:"type";i:1;}s:21:"EscapeInvalidChildren";O:8:"stdClass":1:{s:4:"type";i:6;}s:17:"EscapeInvalidTags";O:8:"stdClass":1:{s:4:"type";i:6;}s:24:"EscapeNonASCIICharacters";O:8:"stdClass":1:{s:4:"type";i:6;}s:14:"HiddenElements";O:8:"stdClass":1:{s:4:"type";i:7;}s:8:"Language";O:8:"stdClass":1:{s:4:"type";i:0;}s:9:"LexerImpl";O:8:"stdClass":2:{s:4:"type";i:10;s:10:"allow_null";b:1;}s:19:"MaintainLineNumbers";O:8:"stdClass":2:{s:4:"type";i:6;s:10:"allow_null";b:1;}s:16:"RemoveInvalidImg";O:8:"stdClass":1:{s:4:"type";i:6;}s:20:"RemoveScriptContents";O:8:"stdClass":2:{s:4:"type";i:6;s:10:"allow_null";b:1;}s:5:"XHTML";O:8:"stdClass":3:{s:9:"namespace";s:4:"HTML";s:4:"name";s:5:"XHTML";s:7:"isAlias";b:1;}s:21:"CommentScriptContents";O:8:"stdClass":3:{s:9:"namespace";s:6:"Output";s:4:"name";s:21:"CommentScriptContents";s:7:"isAlias";b:1;}s:10:"TidyFormat";O:8:"stdClass":3:{s:9:"namespace";s:6:"Output";s:4:"name";s:10:"TidyFormat";s:7:"isAlias";b:1;}}s:6:"Filter";a:5:{s:6:"Custom";O:8:"stdClass":1:{s:4:"type";i:8;}s:18:"ExtractStyleBlocks";O:8:"stdClass":1:{s:4:"type";i:6;}s:7:"YouTube";O:8:"stdClass":1:{s:4:"type";i:6;}s:26:"ExtractStyleBlocksEscaping";O:8:"stdClass":3:{s:9:"namespace";s:11:"FilterParam";s:4:"name";s:26:"ExtractStyleBlocksEscaping";s:7:"isAlias";b:1;}s:23:"ExtractStyleBlocksScope";O:8:"stdClass":3:{s:9:"namespace";s:11:"FilterParam";s:4:"name";s:23:"ExtractStyleBlocksScope";s:7:"isAlias";b:1;}}s:11:"FilterParam";a:3:{s:26:"ExtractStyleBlocksEscaping";O:8:"stdClass":1:{s:4:"type";i:6;}s:23:"ExtractStyleBlocksScope";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:26:"ExtractStyleBlocksTidyImpl";O:8:"stdClass":2:{s:4:"type";i:10;s:10:"allow_null";b:1;}}s:4:"HTML";a:22:{s:12:"EnableAttrID";O:8:"stdClass":3:{s:9:"namespace";s:4:"Attr";s:4:"name";s:8:"EnableID";s:7:"isAlias";b:1;}s:7:"Allowed";O:8:"stdClass":2:{s:4:"type";i:3;s:10:"allow_null";b:1;}s:17:"AllowedAttributes";O:8:"stdClass":2:{s:4:"type";i:7;s:10:"allow_null";b:1;}s:15:"AllowedElements";O:8:"stdClass":2:{s:4:"type";i:7;s:10:"allow_null";b:1;}s:14:"AllowedModules";O:8:"stdClass":2:{s:4:"type";i:7;s:10:"allow_null";b:1;}s:12:"BlockWrapper";O:8:"stdClass":1:{s:4:"type";i:0;}s:11:"CoreModules";O:8:"stdClass":1:{s:4:"type";i:7;}s:13:"CustomDoctype";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:12:"DefinitionID";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:13:"DefinitionRev";O:8:"stdClass":1:{s:4:"type";i:4;}s:7:"Doctype";O:8:"stdClass":3:{s:4:"type";i:0;s:10:"allow_null";b:1;s:7:"allowed";a:5:{s:22:"HTML 4.01 Transitional";b:1;s:16:"HTML 4.01 Strict";b:1;s:22:"XHTML 1.0 Transitional";b:1;s:16:"XHTML 1.0 Strict";b:1;s:9:"XHTML 1.1";b:1;}}s:19:"ForbiddenAttributes";O:8:"stdClass":1:{s:4:"type";i:7;}s:17:"ForbiddenElements";O:8:"stdClass":1:{s:4:"type";i:7;}s:12:"MaxImgLength";O:8:"stdClass":2:{s:4:"type";i:4;s:10:"allow_null";b:1;}s:6:"Parent";O:8:"stdClass":1:{s:4:"type";i:0;}s:11:"Proprietary";O:8:"stdClass":1:{s:4:"type";i:6;}s:6:"Strict";O:8:"stdClass":1:{s:4:"type";i:6;}s:7:"TidyAdd";O:8:"stdClass":1:{s:4:"type";i:7;}s:9:"TidyLevel";O:8:"stdClass":2:{s:4:"type";i:0;s:7:"allowed";a:4:{s:4:"none";b:1;s:5:"light";b:1;s:6:"medium";b:1;s:5:"heavy";b:1;}}s:10:"TidyRemove";O:8:"stdClass":1:{s:4:"type";i:7;}s:7:"Trusted";O:8:"stdClass":1:{s:4:"type";i:6;}s:5:"XHTML";O:8:"stdClass":1:{s:4:"type";i:6;}}s:6:"Output";a:3:{s:21:"CommentScriptContents";O:8:"stdClass":1:{s:4:"type";i:6;}s:7:"Newline";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:10:"TidyFormat";O:8:"stdClass":1:{s:4:"type";i:6;}}s:4:"Test";a:1:{s:12:"ForceNoIconv";O:8:"stdClass":1:{s:4:"type";i:6;}}s:3:"URI";a:14:{s:14:"AllowedSchemes";O:8:"stdClass":1:{s:4:"type";i:7;}s:4:"Base";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:13:"DefaultScheme";O:8:"stdClass":1:{s:4:"type";i:0;}s:12:"DefinitionID";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:13:"DefinitionRev";O:8:"stdClass":1:{s:4:"type";i:4;}s:7:"Disable";O:8:"stdClass":1:{s:4:"type";i:6;}s:15:"DisableExternal";O:8:"stdClass":1:{s:4:"type";i:6;}s:24:"DisableExternalResources";O:8:"stdClass":1:{s:4:"type";i:6;}s:16:"DisableResources";O:8:"stdClass":1:{s:4:"type";i:6;}s:4:"Host";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:13:"HostBlacklist";O:8:"stdClass":1:{s:4:"type";i:8;}s:12:"MakeAbsolute";O:8:"stdClass":1:{s:4:"type";i:6;}s:5:"Munge";O:8:"stdClass":2:{s:4:"type";i:0;s:10:"allow_null";b:1;}s:22:"OverrideAllowedSchemes";O:8:"stdClass":1:{s:4:"type";i:6;}}}} \ No newline at end of file diff --git a/library/HTMLPurifier/VarParser.php b/library/HTMLPurifier/VarParser.php index 418622be..1f5441fc 100644 --- a/library/HTMLPurifier/VarParser.php +++ b/library/HTMLPurifier/VarParser.php @@ -7,21 +7,34 @@ class HTMLPurifier_VarParser { + const STRING = 0; + const ISTRING = 1; + const TEXT = 2; + const ITEXT = 3; + const INT = 4; + const FLOAT = 5; + const BOOL = 6; + const LOOKUP = 7; + const ALIST = 8; + const HASH = 9; + const MIXED = 10; + /** - * Lookup table of allowed types. + * Lookup table of allowed types. Mainly for backwards compatibility, but + * also convenient for transforming string type names to the integer constants. */ static public $types = array( - 'string' => true, - 'istring' => true, - 'text' => true, - 'itext' => true, - 'int' => true, - 'float' => true, - 'bool' => true, - 'lookup' => true, - 'list' => true, - 'hash' => true, - 'mixed' => true + 'string' => self::STRING, + 'istring' => self::ISTRING, + 'text' => self::TEXT, + 'itext' => self::ITEXT, + 'int' => self::INT, + 'float' => self::FLOAT, + 'bool' => self::BOOL, + 'lookup' => self::LOOKUP, + 'list' => self::ALIST, + 'hash' => self::HASH, + 'mixed' => self::MIXED ); /** @@ -29,10 +42,10 @@ class HTMLPurifier_VarParser * allowed value lists. */ static public $stringTypes = array( - 'string' => true, - 'istring' => true, - 'text' => true, - 'itext' => true, + self::STRING => true, + self::ISTRING => true, + self::TEXT => true, + self::ITEXT => true, ); /** @@ -46,42 +59,46 @@ class HTMLPurifier_VarParser * @return Validated and type-coerced variable */ final public function parse($var, $type, $allow_null = false) { - if (!isset(HTMLPurifier_VarParser::$types[$type])) { - throw new HTMLPurifier_VarParserException("Invalid type '$type'"); + if (is_string($type)) { + if (!isset(HTMLPurifier_VarParser::$types[$type])) { + throw new HTMLPurifier_VarParserException("Invalid type '$type'"); + } else { + $type = HTMLPurifier_VarParser::$types[$type]; + } } $var = $this->parseImplementation($var, $type, $allow_null); if ($allow_null && $var === null) return null; // These are basic checks, to make sure nothing horribly wrong // happened in our implementations. switch ($type) { - case 'string': - case 'istring': - case 'text': - case 'itext': + case (self::STRING): + case (self::ISTRING): + case (self::TEXT): + case (self::ITEXT): if (!is_string($var)) break; - if ($type[0] == 'i') $var = strtolower($var); + if ($type == self::ISTRING || $type == self::ITEXT) $var = strtolower($var); return $var; - case 'int': + case (self::INT): if (!is_int($var)) break; return $var; - case 'float': + case (self::FLOAT): if (!is_float($var)) break; return $var; - case 'bool': + case (self::BOOL): if (!is_bool($var)) break; return $var; - case 'lookup': - case 'list': - case 'hash': + case (self::LOOKUP): + case (self::ALIST): + case (self::HASH): if (!is_array($var)) break; - if ($type === 'lookup') { + if ($type === self::LOOKUP) { foreach ($var as $k) if ($k !== true) $this->error('Lookup table contains value other than true'); - } elseif ($type === 'list') { + } elseif ($type === self::ALIST) { $keys = array_keys($var); if (array_keys($keys) !== $keys) $this->error('Indices for list are not uniform'); } return $var; - case 'mixed': + case (self::MIXED): return $var; default: $this->errorInconsistent(get_class($this), $type); @@ -111,7 +128,7 @@ class HTMLPurifier_VarParser * updating subclasses. */ protected function errorInconsistent($class, $type) { - throw new HTMLPurifier_Exception("Inconsistency in $class: $type not implemented"); + throw new HTMLPurifier_Exception("Inconsistency in $class: ".HTMLPurifier_VarParser::getTypeName($type)." not implemented"); } /** @@ -119,7 +136,17 @@ class HTMLPurifier_VarParser */ protected function errorGeneric($var, $type) { $vtype = gettype($var); - $this->error("Expected type $type, got $vtype"); + $this->error("Expected type ".HTMLPurifier_VarParser::getTypeName($type).", got $vtype"); + } + + static public function getTypeName($type) { + static $lookup; + if (!$lookup) { + // Lazy load the alternative lookup table + $lookup = array_flip(HTMLPurifier_VarParser::$types); + } + if (!isset($lookup[$type])) return 'unknown'; + return $lookup[$type]; } } diff --git a/library/HTMLPurifier/VarParser/Flexible.php b/library/HTMLPurifier/VarParser/Flexible.php index a2041fdd..ec2c90f4 100644 --- a/library/HTMLPurifier/VarParser/Flexible.php +++ b/library/HTMLPurifier/VarParser/Flexible.php @@ -14,19 +14,19 @@ class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser // Note: if code "breaks" from the switch, it triggers a generic // exception to be thrown. Specific errors can be specifically // done here. - case 'mixed': - case 'istring': - case 'string': - case 'text': - case 'itext': + case self::MIXED : + case self::ISTRING : + case self::STRING : + case self::TEXT : + case self::ITEXT : return $var; - case 'int': + case self::INT : if (is_string($var) && ctype_digit($var)) $var = (int) $var; return $var; - case 'float': + case self::FLOAT : if ((is_string($var) && is_numeric($var)) || is_int($var)) $var = (float) $var; return $var; - case 'bool': + case self::BOOL : if (is_int($var) && ($var === 0 || $var === 1)) { $var = (bool) $var; } elseif (is_string($var)) { @@ -39,9 +39,9 @@ class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser } } return $var; - case 'list': - case 'hash': - case 'lookup': + case self::ALIST : + case self::HASH : + case self::LOOKUP : if (is_string($var)) { // special case: technically, this is an array with // a single empty string item, but having an empty @@ -56,7 +56,7 @@ class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser } // remove spaces foreach ($var as $i => $j) $var[$i] = trim($j); - if ($type === 'hash') { + if ($type === self::HASH) { // key:value,key2:value2 $nvar = array(); foreach ($var as $keypair) { @@ -70,8 +70,8 @@ class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser if (!is_array($var)) break; $keys = array_keys($var); if ($keys === array_keys($keys)) { - if ($type == 'list') return $var; - elseif ($type == 'lookup') { + if ($type == self::ALIST) return $var; + elseif ($type == self::LOOKUP) { $new = array(); foreach ($var as $key) { $new[$key] = true; @@ -79,7 +79,7 @@ class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser return $new; } else break; } - if ($type === 'lookup') { + if ($type === self::LOOKUP) { foreach ($var as $key => $value) { $var[$key] = true; } diff --git a/tests/HTMLPurifier/ConfigSchemaTest.php b/tests/HTMLPurifier/ConfigSchemaTest.php index a6b28648..9020a3b6 100644 --- a/tests/HTMLPurifier/ConfigSchemaTest.php +++ b/tests/HTMLPurifier/ConfigSchemaTest.php @@ -21,16 +21,12 @@ class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness $this->schema->add('Car', 'Seats', 5, 'int', false); $this->assertIdentical($this->schema->defaults['Car']['Seats'], 5); - $this->assertIdentical($this->schema->info['Car']['Seats'], - new HTMLPurifier_ConfigDef_Directive('int') - ); + $this->assertIdentical($this->schema->info['Car']['Seats']->type, HTMLPurifier_VarParser::INT); $this->schema->add('Car', 'Age', null, 'int', true); $this->assertIdentical($this->schema->defaults['Car']['Age'], null); - $this->assertIdentical($this->schema->info['Car']['Age'], - new HTMLPurifier_ConfigDef_Directive('int', true) - ); + $this->assertIdentical($this->schema->info['Car']['Age']->type, HTMLPurifier_VarParser::INT); } @@ -45,15 +41,13 @@ class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness ); $this->assertIdentical($this->schema->defaults['QuantumNumber']['Difficulty'], null); - $this->assertIdentical($this->schema->info['QuantumNumber']['Difficulty'], - new HTMLPurifier_ConfigDef_Directive( - 'string', - true, - array( - 'easy' => true, - 'medium' => true, - 'hard' => true - ) + $this->assertIdentical($this->schema->info['QuantumNumber']['Difficulty']->type, HTMLPurifier_VarParser::STRING); + $this->assertIdentical($this->schema->info['QuantumNumber']['Difficulty']->allow_null, true); + $this->assertIdentical($this->schema->info['QuantumNumber']['Difficulty']->allowed, + array( + 'easy' => true, + 'medium' => true, + 'hard' => true ) ); @@ -82,20 +76,19 @@ class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness ); $this->assertIdentical($this->schema->defaults['Abbrev']['HTH'], 'Happy to Help'); - $this->assertIdentical($this->schema->info['Abbrev']['HTH'], - new HTMLPurifier_ConfigDef_Directive( - 'string', - false, - array( - 'Happy to Help' => true, - 'Hope that Helps' => true, - 'HAIL THE HAND!' => true - ), - array( - 'happy' => 'Happy to Help', - 'hope' => 'Hope that Helps', - 'hail' => 'HAIL THE HAND!' - ) + $this->assertIdentical($this->schema->info['Abbrev']['HTH']->type, HTMLPurifier_VarParser::STRING); + $this->assertIdentical($this->schema->info['Abbrev']['HTH']->allowed, + array( + 'Happy to Help' => true, + 'Hope that Helps' => true, + 'HAIL THE HAND!' => true + ) + ); + $this->assertIdentical($this->schema->info['Abbrev']['HTH']->aliases, + array( + 'happy' => 'Happy to Help', + 'hope' => 'Hope that Helps', + 'hail' => 'HAIL THE HAND!' ) ); @@ -107,9 +100,9 @@ class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness $this->schema->addAlias('Home', 'Carpet', 'Home', 'Rug'); $this->assertTrue(!isset($this->schema->defaults['Home']['Carpet'])); - $this->assertIdentical($this->schema->info['Home']['Carpet'], - new HTMLPurifier_ConfigDef_DirectiveAlias('Home', 'Rug') - ); + $this->assertIdentical($this->schema->info['Home']['Carpet']->namespace, 'Home'); + $this->assertIdentical($this->schema->info['Home']['Carpet']->name, 'Rug'); + $this->assertIdentical($this->schema->info['Home']['Carpet']->isAlias, true); } diff --git a/tests/HTMLPurifier/SimpleTest/Reporter.php b/tests/HTMLPurifier/SimpleTest/Reporter.php index 1d2c4955..2dcff79e 100644 --- a/tests/HTMLPurifier/SimpleTest/Reporter.php +++ b/tests/HTMLPurifier/SimpleTest/Reporter.php @@ -29,6 +29,14 @@ class HTMLPurifier_SimpleTest_Reporter extends HTMLReporter flush(); } + public function paintFooter($test_name) { + if (function_exists('xdebug_peak_memory_usage')) { + $max_mem = number_format(xdebug_peak_memory_usage()); + echo "
Max memory usage: $max_mem bytes
"; + } + parent::paintFooter($test_name); + } + protected function getCss() { $css = parent::getCss(); $css .= ' diff --git a/tests/HTMLPurifier/VarParser/FlexibleTest.php b/tests/HTMLPurifier/VarParser/FlexibleTest.php index 4578460e..5eca58e9 100644 --- a/tests/HTMLPurifier/VarParser/FlexibleTest.php +++ b/tests/HTMLPurifier/VarParser/FlexibleTest.php @@ -6,7 +6,7 @@ class HTMLPurifier_VarParser_FlexibleTest extends HTMLPurifier_VarParserHarness function testValidate() { $this->assertValid('foobar', 'string'); - $this->assertValid('foobar', 'text'); // aliases, lstring = long string + $this->assertValid('foobar', 'text'); $this->assertValid('FOOBAR', 'istring', 'foobar'); $this->assertValid('FOOBAR', 'itext', 'foobar'); @@ -51,6 +51,10 @@ class HTMLPurifier_VarParser_FlexibleTest extends HTMLPurifier_VarParserHarness } + function testValidate_withMagicNumbers() { + $this->assertValid('foobar', HTMLPurifier_VarParser::STRING); + } + function testValidate_null() { $this->assertIdentical($this->parser->parse(null, 'string', true), null); $this->expectException('HTMLPurifier_VarParserException'); -- 2.11.4.GIT