Deprecating all INI set/get functions and use ini_set/get()
| From: | Yasuo Ohgaki | Date: | Sun, 25 Jan 2015 00:29:52 +0000 |
| Subject: | Deprecating all INI set/get functions and use ini_set/get() | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-81099@lists.php.net to get a copy of this message | ||
Hi all,
I would like to propose INI set/get function deprecation, raise
E_DEPRECATED,
and make PHP_INI_MH() use the CODING_STANDARDS.
For example, session module has following INI set/get functions
- http://php.net/manual/en/function.session-save-path.php
- http://php.net/manual/en/function.session-module-name.php
- http://php.net/manual/en/function.session-cache-expire.php
- http://php.net/manual/en/function.session-cache-limiter.php
- http://php.net/manual/en/function.session-name.php
There are 5 PHP functions for session module alone. Some of them include
runtime check, but
these checks can be done with PHP_INI_MH() by using state parameter. In
fact, runtime
check should be done in PHP_INI_MH() to avoid bugs.
Use of ini_set/get() has following pros and cons
Pros
- Less API, hence simpler API.
- Modules will be less buggy.
i.e. PHP_INI_MH() must handle "state" properly, but it tends to be
forgotten, 3rd party modules especially.
- Consistent coding style/API across modules, both internal and script.
- Reduced documentations. INI descriptions are only in INI section.
- Less documentations, hence less documentation bugs.
- Better documentation. All user needs to know will be in INI section.
- Awareness of INI setting use. Users are better to know they are using
INI. i.e. All INI values has the same limitations,
INI_SYSTEM/INI_PERDIR/INI_USER, stage limitations if any.
- (Please point it out more advantages)
Cons
- Existing code modifications. (It's E_DEPRECATED. User may ignore.)
- (Please point it out more disadvantages)
Comments are appreciated.
Regards,
P.S. Enum for PHP_INI_MH() "stage" parameter type is better in PHP7. IMO.
--
Yasuo Ohgaki
yohgaki@ohgaki.net