Disable PHP strict standards warnings in MAMP?

Does anyone know how to turn off the strict standards warnings when using MAMP?

Why would you want to do that? Those warnings are letting you know which commands in your code will break when the next version of PHP is released.

Because i am working with an MVC that another developer wrote. I’m just using it to get used to the framework, and as such strict standards warnings appearing at the top of the rendered view is highly annoying. The developer is looking into whats causing the errors, but in the mean time i would like to be able to explore without seeing them

The warning that appears is

Strict Standards: Declaration of db::connect() should be compatible with mysqli::connect($host = NULL, $user = NULL, $password = NULL, $database = NULL, $port = NULL, $socket = NULL) in /Applications/MAMP/htdocs/library/classes/database.php on line 258

However line 258 in that file is the end of the script. In the mean time it would be nice to be able to hide this

You can edit the php.ini file, but it can be tricky to work out where that is. See if this helps: http://serverfault.com/questions/235963/mamp-unable-to-turn-off-php-e-strict-error-reporting

So the error wasn’t detected until the end of the file was reached. This means that you need to search back through the file to see where db::connect() is declared in order to correct the way it works so that it will continue to work in PHP 6 and does not continue to rely on things that have been obsolete since PHP 4.

I’m not sure about the particulars of MAMP so I can’t help you there, but I’ll defend you a little. I have strict off. I found that strict was unexpectedly too strict when we turned it on for our project. Here is an example of valid code which gave similar warnings.


class Something_Else extends Something {}

class a {
  public function do_it( Something $something ) {}
}

class b extends a {
  public function do_it( Something_Else $something ) {}
}

It complained that b::do_it needs to be declared to take a Something object. I’m not going to make my code unnecessarily less specific just to pass a standards check.