Page 1 of 1

Strict Standards?

Posted: Sun Feb 19, 2006 2:59 pm
by Benjamin
What are these new "Strict Standards" and why are they breaking all kinds of code?

Posted: Sun Feb 19, 2006 3:01 pm
by feyd
you mean E_STRICT?

Posted: Sun Feb 19, 2006 3:06 pm
by Benjamin
I am using the newest version of phpMyAdmin on a linux pc running php version 5.0.4 and I keep getting errors such as:
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /mnt/storage/server/www/html/complete/database/libraries/storage_engines.lib.php on line 108
This is the second application that doesn't want to work very well under this version of php.

Posted: Sun Feb 19, 2006 3:15 pm
by feyd
PHP 5 introduced access restrictions to class variables. The keyword "var" doesn't exist in strict (meaning strict compliance mode). "var" is from PHP 4. Most scripts you will find in the wild right now are still written for PHP 4 in mind. They can not be completely compliant with 5 while maintaining PHP 4 support without different codebases for their objects, among other variances.

Since the code was written for 4, switching all the instances of "var" in that context to "public" will fix it, generally.

Posted: Sun Feb 19, 2006 4:13 pm
by Roja
agtlewis wrote:I am using the newest version of phpMyAdmin on a linux pc running php version 5.0.4 and I keep getting errors such as:
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /mnt/storage/server/www/html/complete/database/libraries/storage_engines.lib.php on line 108
This is the second application that doesn't want to work very well under this version of php.
Keep in mind that the PHP group realized just how harsh of a switch this was, and in PHP6, it will not give that notice.

It is an E_STRICT notice, not an error or warning.
feyd wrote:Since the code was written for 4, switching all the instances of "var" in that context to "public" will fix it, generally
Keep in mind that public/private don't work in php4, so switching it 'fixes' it for php5, but makes the script not run on php4.

Posted: Sun Feb 19, 2006 4:28 pm
by Ambush Commander
The easiest way, then, if you still want to enforce good coding practices, is set error_reporting to E_ALL (not E_STRICT)