5 ms·
I can't tell you much I'd love to see smarter scalars in PHP, but then for a business what's the difference between upgrading to PHP 6 or upgrading to, say, Pyt
by pestaa 14y ago
I can't tell you much I'd love to see smarter scalars in PHP, but then for a business what's the difference between upgrading to PHP 6 or upgrading to, say, Python?
- kodablah 14y agoThe PHP world is mired in legacy codebases. I have seen many code bases that are on very old, unsupported PHP versions. Although PHP strives to maintain backwards compatibility, it doesn't always work. And many of the backwards incompatible changes are only apparent at runtime and are incredibly difficult discover due to the dynamism of the language and the abuses that are present in most legacy PHP code.
- 0x0 14y ago"PHP strives to maintain backwards compatibility", I'll have to say I've seen enough evidence to the contrary. Even basic object-oriented metaprogramming have been radically changed in minor point/patch releases. Stuff like "get_class_vars()" changing from returning private vars, to not returning private vars, etc. (edit: between PHP v5.2.6 and v5.2.7 if I remember correctly)
- kodablah 14y agoAlthough true, I would say that's kind of an "abuse". I find many PHP functions have changed over versions to give more predictable output and validate expected input more stringently. If backwards compatibility wasn't a concern, they would attempt to standardize the lib in obvious incompatible ways.
- 0x0 14y agoWell, backwards compability is kind of a binary thing, isn't it. Either you're aiming for backwards compability and you can be sure your legacy code will keep running, or you don't. In fact it would be more helpful to throw fatal errors because a method signature changed, than start returning different and unexpected values which can break data integrity in subtle ways.
- jiggy2011 14y agoespecially nasty is magic_quotes , switch your old website to a new webhost (or have your existing one upgrade their PHP installation) and you get instant SQLi vulnerabilities.
- smsm42 14y agoIf you relied on magic_quotes for security, you deserve it.
- jiggy2011 14y agoIn my defence, it wasn't my code but I was hosting it. Getting 3 angry "why does my website have porn all over it" calls in one day isn't fun.
- Firehed 14y agomagic_quotes has been deprecated for three and a half years, and widely understood to be a bad idea for around a decade. If you don't check your configs when moving to a new host, you get what's coming to you.
- jiggy2011 14y agoyou'd be surprised how many small businesses still have ~10+ year old websites.
- stesch 14y agoOh, yeah, the magic_quotes. They implemented something like this without knowing anything about SQL. PHP supported different SQL databases, but they implemented some kind of protection in a non standard way, just because it was supported by MySQL.
- stesch 14y agoToday's PHP doesn't really want to support legacy code. A customer's hosting provider forces an upgrade to PHP 5.4 in April. They tested a CMS and it is broken. Just because the CMS used split() instead of explode(). Deprecated function.
- tomschlick 14y agoThe difference would be converting all the places in your code from strlen($string) to $string->length() instead of rewriting it. One may take a few days/weeks to do in an existing app. The other would take months if not years to get out the door, test, and deploy.