UPDATED Dec 2015: The maintainer of Savant (currently Brett Bieber has kinda abandoned the previous Savant project or he’s too not motivated to move it forward, and he is even very hostile to pull requests on github. So, I came up with a FORK of it and I’m happy to announce, I will be maintaining the new fork. So move from the old php savant to Savant PHP => http://7php.github.io/SavantPHP/
If you are a PHP SAVANT user, and if you have switched to PHP 5.3, you will immediately notice that you get an error message when using it, something similar to: “Fatal error: Method Savant3::__tostring() cannot take arguments in /opt/lampp/htdocs/www/php/includes/lib/Savant3.php on line 192”
I know you are eager for a solution, so let’s get to it and after that I will make some remarks and analysis.
Solution To Savant3 Error: Method Savant3::__tostring() cannot take arguments
Take It On Me Solution A
Updated Dec 2015: Please use the new improved Savant PHP – click
(it comes with namespace support and installable via composer – yay!)
=> Download my modified Savant3.php class file and overwrite yours
Do It YourSelf Solution B
1) In your savant folder, find the php file named as “Savant3.php“.
2) Open Savant3.php
3) Go to line 182, or simple make a search for “public function __toString($tpl = null)”
4) Replace the whole function body with the following:
public function __toString()
$tpl = $this->__config[‘template’];
$output = $this->fetch($tpl);
$text = $this->__config[‘error_text’];
5) Go to line 950, or search for “public function display($tpl = null)”
6) Replace the whole function body with the following:
public function display($tpl = null)
if (is_null($tpl) && $this->__config[‘template’] == “”)
$this->__config[‘template’] = $tpl;
Why No Solution On the Savant3 Home Page
Currently, on the date of this post, the savant home page notifies its users of this potential issue. They claim to have fixed it and thus provided a modified version Savant 3.0.1. BUT this version does not seem to be available for download till now. I believe it might have been a confusion from either Paul or Brett, and they have somehow mixed the version Savant 3.0.0 with the Savant 3.0.1. Anyhow, I hope they fix it soon.
What’s Up With The __tostring() Issue?
Well, this issue is not with SAVANT as such, since it originates with the new PHP version 5.3
With PHP 5.3, the magic method __tostring() no more accepts any parameter.
As you might have guessed, SAVANT3 implements its __tostring() by accepting parameter $tpl which is now deprecated in favor of the new __tostring() for PHP 5.3