Jump to content

Error when extending HTML Purifier Class


Arnsenal

Recommended Posts

Im trying to use the HTMLPurifier's class's functions inside my class by extending my class from it.  :shrug:

http://htmlpurifier.org/

 

Here is what I get for an error.

 

 

Warning: Passing a prototype to HTMLPurifier_Lexer::create() is deprecated, please instead use %Core.LexerImpl in C:\Users\Jerry\Desktop\Web Dev\Local Host - Web Dev\PHPTester\library\HTMLPurifier\Lexer.php on line 74

 

Fatal error: Call to a member function get() on a non-object in C:\Users\Jerry\Desktop\Web Dev\Local Host - Web Dev\PHPTester\library\HTMLPurifier\Lexer.php on line 80

 

 

Having a very hard time even seeking information, my knowledge of php is too limited to begin to know where to look.

 

Do I need to provide more information?

 

Thanks

 

Jerry

Link to comment
Share on other sites

Thanks Thorpe

 

Yes the error is generated by Lexer.php which I attached.

 

Here is my class code that is giving me the errors.

 

require_once '/library/HTMLPurifier.auto.php';

$db_info = array ('host','user_name','password','db','table');

$purifier = new HTMLPurifier();

class s_v extends HTMLPurifier {
    
public $clean_array;
public $empty_fields_array = array();
public $invalid_fields_array = array();
private $db_info;

public function __construct($dirty_array,$db_info) {
	foreach ($dirty_array as $key => $value) {
		$value = $this->purify($value);			
	}
	$this->clean_array=$dirty_array;
	$this->db_info = $db_info;
	echo "'$this->db_info[0]'"."'$this->db_info[1]'"."'$this->db_info[2]'"."'$this->db_info[3]'";
}
}
$sv = new s_v($req_post_array,$db_info);

 

There are notes in the lexer.php file.

Thanks again. It would be awesome if you pointed me in the right direction even if you don't have time to help working out the solution.

17751_.php

Link to comment
Share on other sites

Ok I may be on to something.

 

http://us3.php.net/manual/en/language.oop5.paamayim-nekudotayim.php

 

A couple questions

 

1. Am I suppose to be using :: to access functions from the class I'm extending?

 

2. If I'm extending a  class that has a constructor and I create another constructor in my extended class then instantiate the extended class do both constructors run, or does one have precedence?

 

Thanks

 

Jerry

Link to comment
Share on other sites

1) If the methods are declared as static

2) No, you need to explicitly call the parent __construct within your classes's __construct and pass through any required params. eg;

 

public function __construct($foo)
{
    parent::__construct($foo);
}

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.