To help ease the transition from 5.6 to 7.0 I have created a simple package that acts as a shim between the newly removed ext/mysql and ext/mysqli.
I was a little hesistent to even publish this as I don’t want to encourage the continued use of potentially insecure code, however, I want people to upgrade to 7.0 and don’t want this to be the blocker.
It does require 5.6 (though it would be possible to lower that) — however I suspect that most people who are upgrading to 7.0 are either coming from 5.6 or have the native ext/mysql. The primary reason for support 5.6 is to be able to compare the test suite results against native ext/mysql.
It’s not yet production ready, but tests are coming along pretty well (PRs welcome!):
Current known (and unlikely to be fixed) issues are:
You must prefix all calls toNot sure why I thought this, but non-internal functions do fall back to the global namespace.mysql_*with a(e.g.mysql_connect());- Calls to
is_resource()andget_resource_type()on MySQL connections and results will fail as these are now theirmysqliequivalents.
-Some errors are now fromext/mysqli, and others areE_USER_WARNINGinstead ofE_WARNING. Where possible, the original error messages are replicated. - Column lengths reported by
mysql_field_len()assumelatin1charset, and will return incorrect lengths for other charsets.
You can check it out now on Github.
^Image Courtesy of Egan Snow, used under a CC-BY-SA 2.0 license.
Source: Planet PHP

