Language and development rules: Difference between revisions

Jump to navigation Jump to search
m
mNo edit summary
Line 40: Line 40:
*Usage of PHP superglobals variables must use the dedicated operators $_COOKIES, $_SERVER, $_ENV but use the Dolibarr function GETPOST() to get the contents of $_GET or $_POST..
*Usage of PHP superglobals variables must use the dedicated operators $_COOKIES, $_SERVER, $_ENV but use the Dolibarr function GETPOST() to get the contents of $_GET or $_POST..


Other operators ($HTTP_SERVER_GET, ...) are now deprecated in PHP, so they must not be used. Code must work if option '''register_long_arrays''' is set to off.
* Other operators ($HTTP_SERVER_GET, ...) are now deprecated in PHP, so they must not be used. Code must work if option '''register_long_arrays''' is set to off. Moreover, the code must work when PHP option '''register_globals''' is off (recommended by PHP). It must also work the if the option '''register_globals''' is on (by default on a lot of installations).
Moreover, the code must work when PHP option '''register_globals''' is off (recommended by PHP). It must also work the if the option '''register_globals''' is on (by default on a lot of installations).


*Do not use '''PHP_SELF'''. Use instead $_SERVER["PHP_SELF"]. Also, Dolibarr framework sanitizes content of $_SERVER["PHP_SELF"] variable (into main.inc.php file, before any business code).
*Do not use '''<s>PHP_SELF</s>'''. Use instead '''$_SERVER["PHP_SELF"]'''. Also, Dolibarr framework sanitizes content of $_SERVER["PHP_SELF"] variable (into main.inc.php file, before any business code).


*When several variables must be initialized with the same value, you must use individual declarations (separated by ;)
*When several variables must be initialized with the same value, you must use individual declarations (separated by ;)
1,988

edits

Navigation menu