Guest Posted March 19, 2019 Posted March 19, 2019 I needed a shim to support mysql_* on PHP7 and found this on Github. It's basically a drop in replacement for mysql allowing to use all that goodness, basically uses mysqli under the hood, not sure if anyone is running any games with old mysql_ functions and wants to upgrade to PHP 7. Had no issues so far. Quote
Magictallguy Posted March 20, 2019 Posted March 20, 2019 Please note that shims are designed to be used temporarily while you update your code. Quote
Guest Posted March 20, 2019 Posted March 20, 2019 47 minutes ago, Magictallguy said: Please note that shims are designed to be used temporarily while you update your code. Meh, I disagree, as this is using mysqli under the hood, I don't see any reason if you have a massive code base to update it. A shim is to fill a gap, nothing temporary about it. We don't live in a perfect world and sometimes it's unreasonable or near impossible to update the code base. Quote
sniko Posted March 21, 2019 Posted March 21, 2019 > A shim is to fill a gap, nothing temporary about it. Nothing more permanent than a temporary fix. 2 Quote
Alan Posted March 21, 2019 Posted March 21, 2019 As much as I dislike the actual code here - I'm with Ian on this one - it's perfectly acceptable to run shims for considerable lengths of time - quite possibly project lifetime - to address issues of legacy code; unusual libraries etc. Those familiar with the Design Patterns book will note that are a number of patterns which can be considered shim's in their own right -- adapter, facade and proxy if memory serves me. Have a look in your vendor folder(s) ... I'll pretty much bet you'll find at least one instance of these though perhaps named differently in any current project. Quote
Guest Posted March 21, 2019 Posted March 21, 2019 1 minute ago, Alan said: As much as I dislike the actual code here - I'm with Ian on this one - it's perfectly acceptable to run shims for considerable lengths of time - quite possibly project lifetime - to address issues of legacy code; unusual libraries etc. Those familiar with the Design Patterns book will note that are a number of patterns which can be considered shim's in their own right -- adapter, facade and proxy if memory serves me. Have a look in your vendor folder(s) ... I'll pretty much bet you'll find at least one instance of these though perhaps named differently in any current project. Hold hold hold up - you agree. Well I'll be damned, first time for everything eh Quote
FoohonPie Posted March 21, 2019 Posted March 21, 2019 There is code that is perfect that never gets done, and then there is code that is imperfect that gets a project to its users. Sometimes worse is better than better. 1 Quote
Dave Posted March 22, 2019 Posted March 22, 2019 In the JavaScript world people have been running shims as permanent solutions for missing browser API in older browsers for years. If a shim is stable and suitable for your issue it’s a great solution to bridging a gap. I’d still promote refactoring the code if you can (like with this MySQL shim, can’t really do that with browser APIs) over time as lack of prepared statements and other good features of directly using MySQLi or PDO would be missing from your code base. Quote
Magictallguy Posted April 27, 2019 Posted April 27, 2019 Welp, time to eat my own words - I actually have a use-case for this! (specifically, running RC Engine dated October 2014 - wanted to see it) 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.