Welcome! » Log In » Create A New Profile

Variable $purifier = NULL

Posted by dlaure 
Variable $purifier = NULL
November 06, 2014 02:44AM


when working on localhost, the HTMLPurifier standalone version works perfectly. When trying to make it work online, it's not working at all, here is the error :

Fatal error: Call to a member function purify() on a non-object in file.php on line 153

and the $purifier variable returns nothing

Is there a solution?

Thank for your time.


Edited 1 time(s). Last edit at 11/06/2014 02:44AM by dlaure.

Re: Variable $purifier = NULL
November 06, 2014 03:45AM

The problem have been solve, it was an error in the coding.

Friedrich Bartels
Re: Variable $purifier = NULL
May 23, 2015 05:35AM

Hey folks, iam pretty new to HTMLPurifier but i love it. Okay here is the problem i get on only 1 of 10 sites and I have no idea why and i dont find the problem in this forum:

Call to a member function purify() on null

When I not purify the variable, its fine. Its not null but its not displayed if i clean it...

$companyName = $purifier->purify($company["companyName"]);

thats all i need to post, because this one throws the exception. And the data in $company["companyName"] is not even anything to clean in this case.

Thx for reading!


Friedrich Bartels
Re: Variable $purifier = NULL
May 23, 2015 05:41AM

Okay, its always like that. I can search for hours, but if I want to find the answer on my own, I just need to post it in a forum!

Okay for the guys, that may have the same problem in future: I called $purifier->purify in a seperated function in the header. So to solve the problem, i had to declare the variables

$config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier($config);

in that function again, because (ofc) they are not global.

Thx for helping me, myself!

Re: Variable $purifier = NULL
March 06, 2017 08:03PM

Friedrich, I missed your message. Do you still have the problem?

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