Re: ext/mysql in PECL and E_DEPRECATED
| From: | Mailing list | Date: | Wed, 28 Nov 2012 23:11:25 +0000 |
| Subject: | Re: ext/mysql in PECL and E_DEPRECATED | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-64085@lists.php.net to get a copy of this message | ||
.. annoying top posting...
This is getting close to a good solution.
ini option mysql_is_deprecated - can not be set in .ini/htaccess etc, only by ini_set() - so hosters/distros can not fix it...
Normally added just before mysql_connect...
ini_set('mysql_is_deprecated', "I WILL NOT USE IT IN THE FUTURE");
mysql_connect(......)
if the ini value is not set, then mysql_connect() can issue a E_DEPRECATED warning
"Mysql is deprecated, use mysqli or PDO, to remove this warning you can set mysql_is_deprecated"
They then have to google mysql_is_deprecated, which tells them to use the magic string...
Solves:
- Users will get warnings on upgrading - it can not be hidden by hosters/distros etc.
- Users can easily disable the warning, however they will be explicitly aware of the problem.
Backwards/forward compatible....
Regards
Alan
On Thursday, November 29, 2012 07:00 AM, David Muir wrote:
On 29/11/12 05:09, Ángel González wrote:I see it as simple to show E_DEPRECATED but not when installed from PECL. 1) Add a int mysql_extension_triggers_deprecated_warning = 1; And use it as a conditional for triggering the warning. 2) Copy the extension code to PECL 3) Add these changes in PECL - If the mysql functions are not already registered, register them with the bundled code. - Set mysql_extension_triggers_deprecated_warning = 0; 4) That's it.Then people (distros, hosts, etc) will just install it from PECL instead to avoid all the E_DEPRECATED mess. David