I get the following error in the log when an unauthenticated user is viewing content:
user warning: Value not supported, valid values are: Serializer in /kast/www2/ideed.anttila.ee/sites/all/modules/htmlpurifier/library/HTMLPurifier/Config.php on line 232.


yhager’s picture

Title: Unauthenticated user+error » user warning: Value not supported in HTMLPurifier
yhager’s picture

I am also getting this same error. Could it be relating to setting the cache incorrectly?

yhager’s picture

I managed to get rid of the error above by setting full permissions on the cache directory (as noted at http://htmlpurifier.org/download.html#toclink0), and also change the function htmlpurifier_create_purifier() to read:

function htmlpurifier_create_purifier($config) {
  // Load HTML Purifier library
  $module_path = drupal_get_path('module', 'htmlpurifier');
  require_once "$module_path/library/HTMLPurifier.auto.php";

  // Overload HTML Purifiers default cache handler with our own so that
  // Drupals built-in cache is used
//   require_once "$module_path/HTMLPurifier_DefinitionCache_Drupal.php";
//   $factory =& HTMLPurifier_DefinitionCacheFactory::instance();
//   if (method_exists($factory, 'register')) {
//     $factory->register('Drupal', 'HTMLPurifier_DefinitionCache_Drupal');
//   } else {
//     // Brittle, used for previous HTML Purifier version compatibility
//     $factory->caches['Drupal']['HTML'] = new HTMLPurifier_DefinitionCache_Drupal('HTML');
//     $factory->caches['Drupal']['CSS']  = new HTMLPurifier_DefinitionCache_Drupal('CSS');
//     $factory->caches['Drupal']['URI']  = new HTMLPurifier_DefinitionCache_Drupal('URI');
//   }
//   $config['Cache.DefinitionImpl'] = 'Drupal';

  return new HTMLPurifier($config);

I am not recommending this for production, since it doesn't use Drupal's caching like intended, but it works for the moment.

Module author: please step in to provide the correct solution. Thanks.

kripaludas’s picture

I was getting this error as well.

On the page http://htmlpurifier.org/ there are two downloads: HTML Purifier 2.1.3 zip and HTML Purifier 2.1.3 for PHP 5 zip. Because I have PHP 5 installed, naturally I tried using that version. However that version does not have Serializer and hence the errors.

I went back to http://htmlpurifier.org/ and got the first zip instead (the non-PHP5 version) [http://htmlpurifier.org/releases/htmlpurifier-2.1.3.zip]. I extracted the library directory from it, set owner and permissions for apache 755, and now no error. It seems to work fine.

icalvo’s picture

It seems that the Drupal module does not extend the HTMLPurifier_ConfigSchema singleton to have it allow Drupal as a valid Definition Cache. I have inserted this line at htmlpurifier.module:

  HTMLPurifier_ConfigSchema::defineAllowedValues('Cache', 'DefinitionImpl', array('Serializer','Drupal'));

Just before:

  return new HTMLPurifier($config);

which is the line that causes this error. So far, it is working.

ezyang’s picture

I need to figure out how to make all bug reports mail to me. My apologies for the late response. icalvo, your solution is correct and will be added to the CVS repository.

ezyang’s picture

Status: Active » Closed (fixed)

Closed as fixed. If anyone would like to test the fix on another configuration, that would be greatly appreciated.