Welcome! » Log In » Create A New Profile

URI.Base and URI.MakeAbsolute won't work

Posted by laacz 
URI.Base and URI.MakeAbsolute won't work
August 03, 2007 04:48PM

That is strange. For me the following won't work:

$purifier_config->set('URI', 'Base', 'http://laacz.lv/');
$purifier_config->set('URI', 'MakeAbsolute', true);
$body = $purifier->purify($body, $purifier_config);

And that throws an error:

PHP Fatal error: URI.MakeAbsolute is being ignored due to lack of value for URI.Base configuration in /usr/local/lib/php/HTMLPurifier/URIFilter/MakeAbsolute.php on line 27

Thogh, things are set properly. I've done a quick debug by putting following line:

error_log("$namespace.$key=$value");

on line just before assinging value to config key in HTMLPurifier/Config.php. And it showed, that URI.Base is assigned correctly.

Re: URI.Base and URI.MakeAbsolute won't work
August 03, 2007 05:05PM

Argh, that's what I get for not integration testing. Patch:

Index: URIDefinition.php
===================================================================
--- URIDefinition.php	(revision 1352)
+++ URIDefinition.php	(working copy)
@@ -103,13 +103,13 @@
     }
     
     function addFilter($filter, $config) {
-        $filter->setup($config);
+        $filter->prepare($config);
         $this->filter[$filter->name] = $filter;
     }
     
     function doSetup($config) {
+        $this->setupMemberVariables($config);
         $this->setupFilters($config);
-        $this->setupMemberVariables($config);
     }
     
     function setupFilters($config) {

I forgot to setup the member variables before setting up the filters, since the filters may depend on the member variables. Gah!

(The top fix is another, unrelated bug that I unearthed investigating this problem)

Re: URI.Base and URI.MakeAbsolute won't work
August 04, 2007 08:12AM

OK. Thanks. Now it works.

Sorry, you do not have permission to post/reply in this forum.