zlacker

[parent] [thread] 8 comments
1. mgkims+(OP)[view] [source] 2022-12-08 13:29:01
Can you give some specific examples? I can't think of too many 'fundamental breaking changes' in PHP between major versions. Some things that will be changed in 9 are now deprecated in 8.2.

PHP has gone through a few changes.

PHP 3->4 was a moderately big change under the hood, and introduced a lot of new things, but most 3 'worked' under 4 (but was... awkward).

PHP 4->5 - a few 'big' things changed - XML processing changed - I had to use some shims to get some projects upgraded.

PHP 5->7 - my recollection, and that of most colleagues, is that this was pretty painless for most projects. I can't recall too many major breaking changes, but it was mostly just getting a doubling of speed without any substantive changes.

The PHP community has a couple decades of 'major version changes' to look at to learn from. I still can't say I agree with 100% of the decisions, but it's still progressing nicely.

replies(2): >>bawolf+A7 >>denton+3b
2. bawolf+A7[view] [source] 2022-12-08 14:20:44
>>mgkims+(OP)
Php 7 -> Php 8 is where php has really started making more breaking changes (for better or worse). Or at least introduced lots of new warnings.
replies(1): >>hakre+cC6
3. denton+3b[view] [source] 2022-12-08 14:42:34
>>mgkims+(OP)
> PHP 5->7 - my recollection, and that of most colleagues, is that this was pretty painless for most projects.

They replaced the MySQL plugin in version 7. All MySQL code was broken. I don't know, but I'd guess that most PHP sites were using MySQL as their database (the 'M' in 'LAMP' stands for MySQL).

replies(3): >>abujaz+Fc >>danari+8j >>stephe+K21
◧◩
4. abujaz+Fc[view] [source] [discussion] 2022-12-08 14:51:33
>>denton+3b
Using mysql_ functions directly was very outdated and long deprecated when 7 was released. Any reasonably maintained code base had already been using mysqli or PDO for years.
◧◩
5. danari+8j[view] [source] [discussion] 2022-12-08 15:27:21
>>denton+3b
I thought I had to replace all my mysql code in a massive overhaul to upgrade from 5.x to 7.x.

Then I read a little closer, and realized I pretty much just had to add an "i" onto all the underlying mysql functions ("mysql_" to "mysqli_"), at least for the ones I was using commonly.

I'm still in the process of migrating that project, now on 7.4, to a modern Symfony framework, but I tested it out in 8.1 the other day, and it needed...1 change to work apparently perfectly.

I'm still going to need to do more thorough testing before I put production on 8.x, but with 7.x now unsupported, that has become a priority.

replies(1): >>mgkims+RG
◧◩◪
6. mgkims+RG[view] [source] [discussion] 2022-12-08 17:07:26
>>danari+8j
IIRC the parameter order for some parameters differs between mysql_* and mysqli_* functions. But as someone else said above, built-in PDO or some other abstraction library for data access has been the way to go for more than a decade (more like closer to 20 years at least).

That said, I'm still surprised when I come in to codebases where people are still using hard-coded db function calls all over the place (mysql_* or mysqli_) I indicate that abstracting that away should be a priority. Even doing something as simple as "I want to log all the queries that I'm making for debug purposes" is essentially impossible when you have hundreds of individual calls to mysql_ embedded throughout the code. But... I've not come in to a codebase in the last... 4-5 years that does that, so either I've been lucky or that coding behavior is indeed becoming a thing of the past.

replies(1): >>danari+2N
◧◩◪◨
7. danari+2N[view] [source] [discussion] 2022-12-08 17:38:08
>>mgkims+RG
Yyyyep. That's a big part of the migration I've been working on. However, it's a non-monetized side project that I inherited with a loooot of legacy code, so it's not exactly going to be speedy.
◧◩
8. stephe+K21[view] [source] [discussion] 2022-12-08 18:58:58
>>denton+3b
> All MySQL code was broken.

Not quite. Code that *wasn't* using either of the two modern APIs for MySQL was "broken".

They removed the oldest, jankiest of the three APIs for connecting to MySQL in php7.

MySQLi (literally, "MySQL Improved" extension) was introduced with PHP 5.0, in 2004.

PDO was introduced with PHP 5.1 in 2005.

The documentation started showing "soft deprecation" notices on mysql_* functions in 2012. It was already common practice to advise people to upgrade to either mysqli or PDO.

The old mysql extension was deprecated as of php5.5, in 2013.

The final shipped version with the mysql extension was 5.6, which was supported until 2018 - half a decade after the deprecation was added.

◧◩
9. hakre+cC6[view] [source] [discussion] 2022-12-10 14:51:30
>>bawolf+A7
Deprecation warnings for the most. But those can be taken away so you can have PHP 5/7/8 code without much deviation.

More than a LTS release I'd prefer more PHP 8 releases than the five in 7.x, e.g. more until 8.8 or 8.9.

[go to top]