php - Strict Standards: Declaration of RPA::PreLoadField() should be compatible with that of Foundation::PreLoadField()

443

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..

524

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:

class A
{
    public function blah($a, $b) { }
}

class B extends class A
{
    public function blah($a) { }
}

PHP will complain about that (as it should). Does calling code need to provide 1 argument or two?

849

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.

390

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.

People are also looking for solutions to the problem: How grouping data with php and display it inside table (table in table)?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.