diff options
-rw-r--r-- | CONTRIBUTING.md | 50 | ||||
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | README.md | 11 |
3 files changed, 79 insertions, 3 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..711fd81 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,50 @@ +# Contributing + +## Forking + +You should be working in a fork, see the [following documentation](https://help.github.com/articles/fork-a-repo/) + +## Before Making Any Changes + +### Fetch The Latest Changes from upstream + +> On the `master` branch + +```sh +$ git fetch --all +$ git rebase upstream/master +``` + +### Create a New Branch + +```sh +$ git checkout -b reason-for-changes +``` + +### Refresh Dependencies + +```sh +$ composer install +``` + +## Testing Your Changes + +In the root directory, you can run the test suite by running: + +```sh +$ vendor/bin/phpunit +``` + +## After Making Your Changes + +### Commit Your Changes + +```sh +$ git add [files...] +$ git commit -m "DESCRIPTION OF CHANGES" +$ git push origin master +``` + +## Pushing Changes Back Upstream + +To contribute your changes back, simply perform a [Pull Request](https://help.github.com/articles/using-pull-requests/) against the master branch. @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Davey Shafik + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. @@ -8,6 +8,12 @@ This library attempts to create a drop-in replacement for ext/mysql on PHP 7 usi For the most part, it should _just work_, although you either need to prefix all calls with a `\` (only internal functions will fallback to the global scope) or import the functions into every file (e.g. `use function \mysql_connect`). +## Why You Shouldn't Use This Library + +This library is meant to be a _stop-gap_. It will be slower than using the native functions directly. + +**You should switch to `ext/pdo_mysql` or `ext/mysqli`, and migrate to [prepared queries](http://php.net/manual/en/pdo.prepared-statements.php) to ensure you are securely interacting with your database.** + ## Installation To install, either add `dshafik/php7-mysql-shim` to your `composer.json`: @@ -20,13 +26,12 @@ or, clone/download this repo, and include `mysql.php` in your project. ## Usage -Once the file is included, it will create `mysql_*` function if they don't already exist. +Once the file is included, it will create `mysql_*` function if they don't already exist. _**You may safely include the file in a PHP 5.x project**_, it will do nothing. ## Caveats - Calls to `is_resource()` and `get_resource_type()` on MySQL connections and results will fail as these are now their `mysqli` equivalents. - Some errors are now from `ext/mysqli`, and others are `E_USER_WARNING` instead of `E_WARNING`. - You must use the `mysqli.*` INI entries instead of `mysql.*` (e.g. `mysqli.default_user` instead of `mysql.default_user`) +- If no host, username, password parameter is provided when using the `mysql_*` functions, the default values from the corresponding `mysqli.*` settings from `php.ini` file will be use (e.g. `mysqli.default_host`, `mysqli.default_user`, `mysqli.default_pw`) - Column lengths reported by `mysql_field_len()` assume `latin1` -- If no host, username, password parameter is provided when using the `mysql_*` functions, the default values from the corresponding `mysqli.*` settings from `php.ini` file will be used -(e.g. `mysqli.default_host`, `mysqli.default_user`, `mysqli.default_pw`) |