Language and development rules: Difference between revisions

Jump to navigation Jump to search
no edit summary
Tag: 2017 source edit
No 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. 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).
*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 if the option '''register_globals''' is on (by default on a lot of installations).


*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).
*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).
Line 59: Line 59:
<br />
<br />


==== Strings ====
====Strings====


*Strings must be delimited by a single or double quote and a variable within the string must be outside of the quote.
*Strings must be delimited by a single or double quote and a variable within the string must be outside of the quote.

Navigation menu