php - Strict Standards: Declaration of RPA::PreLoadField() should be compatible with that of Foundation::PreLoadField()
When I run index.php and loads the page, it comes up with below error:
Strict Standards: Declaration of RPA::PreLoadField() should be compatible with that of Foundation::PreLoadField() in C:\xampps\htdocs\Res\RPA.php on line 39
I've had a look at line 39 of RPA.php and this is class called:
class RPA extends Foundation
any ideas on this error?
This function is from foundations class:
public function PreLoadField($table, $column, $rowid, $coldata, &$value, $disabled=false)
{
$retval = false;
if ($table === 'photos')
{
if ($column === 'blogentry')
{
$value = LookUpBlogEntries ($column, $coldata[$column]);
$retval = true;
}
}
return $retval;
}
This function is from RPA class:
public function PreLoadField($table, $column, $rowid, $coldata, &$value)
{
$retval = parent::PreLoadField($table, $column, $rowid, $coldata, &$value);
return $retval;
}
RPA extends Foundation..
Answer
Solution:
My guess (since you didn't post enough code to tell) is that you're over riding a method in a parent class with a different signature. Like:
PHP will complain about that (as it should). Does calling code need to provide 1 argument or two?
Answer
Solution:
I experienced similar warnings when I turned E_STRICT on in a joomla installation. In every single case I checked both functions and found that the problem was the number of parameters passed in one function was different than the other. As a general rule I was able to fix all errors by adding the missing parameter (something like $param = null).
I suggest you do a search on your entire code to see how both functions are being called. This will probably give you a clue about how to fix the problem.
Good luck!
PS: by the way, in my experience you don't necessarily have to fix those warnings. In my case joomla was working fine before I fixed the warnings.
Answer
Solution:
In your php.ini file you need to change your error_reporting setting to exclude E_STRICT. For instance: error_reporting(E_ERROR | E_WARNING | E_PARSE);
Please note that E_ALL also causes the issue because it includes E_STRICT since PHP#5.0.0.