coding-standard icon indicating copy to clipboard operation
coding-standard copied to clipboard

Forbid more functions

Open gmponos opened this issue 5 years ago • 0 comments

Hi... I recently opened this #199

Instead of going wild and opening one by one a PR I thought about initiating a discussion here.

I believe there are more functions that can be forbidden:

'__autoload' => null,  // no reason to use this function since composer is out there

'define' => null,
'each' => null,  // @see http://php.net/manual/en/migration72.deprecated.php
'create_function' => null, // why using this?

// debug functions
'debug_backtrace' => null,
'debug_print_backtrace' => null,
'die' => null,
'exit' => null,
'phpinfo' => null,
'print_r' => null,
'var_dump' => null,

// Use a logger lib (preferably a PSR-3 one)
'error_log' => null,

// Framework debug functions
'dd' => null,
'dump' => null,

// use an HttpClient library instead.
'curl_exec' => null,
'curl_init' => null,
'curl_multi_exec' => null,

// Use a process library.. 
'exec' => null,

// The following functions should not be allowed inside a project and they should be set by your php.ini unless if you are building a very specific library.
'ini_alter' => null,
'ini_restore' => null,
'ini_set' => null,
'date_default_timezone_set' => null,

'apache_request_headers' => null, // Exists only on Apache webservers
'apache_response_headers' => null, // Exists only on Apache webservers
'getallheaders' => null, // Is an alias of apache_request_headers()

'putenv' => null, // use $_SERVER or $_ENV variable directly // https://github.com/laravel/framework/issues/7354
'getenv' => null,

ofc users can override this on their projects but it would be good to promote these as a good practice.

Let me know WDYT.. maybe discussing all this in one issue might be an overhead and I should open smaller ones?

gmponos avatar Jun 17 '20 09:06 gmponos