Home >Backend Development >PHP Tutorial >How to deal with PHP Strict Standards errors_PHP Tutorial
The day before yesterday, I accidentally modified the error output settings of php.ini. Today, when I was testing a project developed by CakePHP, I found several more error prompts. Although they are not fatal, they cannot be ignored.
The error description is roughly as follows: www.2cto.com
Strict Standards: Redefining already defined constructor for class Object in D:wwwhostscakeucake-libscakelibsobject.php on line 69
Strict Standards: Assigning the return value of new by reference is deprecated in D:wwwhostscakeucake-libscakelibsobject.php on line 94
Strict Standards: Assigning the return value of new by reference is deprecated in D:wwwhostscakeucake-libscakelibssecurity.php on line 48
Strict Standards: Assigning the return value of new by reference is deprecated in D:wwwhostscakeucake-libscakelibsinflector.php on line 65
Strict Standards: Assigning the return value of new by reference is deprecated in D:wwwhostscakeucake-libscakelibsconfigure.php on line 89
Strict Standards: Non-static method Configure::getInstance() should not be called statically in D:wwwhostscakeucake-libscakebootstrap.php on line 43
Strict Standards: Non-static method Configure::write() should not be called statically in D:wwwhostscakeucake-libscakebootstrap.php on line 82
Strict Standards: Non-static method Configure::getInstance() should not be called statically in D:wwwhostscakeucake-libscakelibsconfigure.php on line 108
After a few glances, I saw that it was basically an error in the CakePHP framework. When I searched for relevant error information in Google, I found that this common problem also exists in other frameworks, and I was impatient. . .
I had to read the error explanation carefully, and what I understood was: a warning given because the program was not written in accordance with the strict rules of PHP. Thinking of this, I tested several small programs I had written before, and some of them also had this error. It seems that I have to pay attention to my own coding standards in the future and cannot blindly pursue functions...
Since the current project needs to be debugged, the php.ini error output is redefined as: error_reporting = E_ALL. Removed E_STRICT, restarted Apache...everything is as usual...
Excerpted from joy's