3 ms·
OK, I'll bite... I'm a co-founder of a software consultancy and we've actively marketed PHP4->PHP5 upgrades after we did a couple large, successful projects th
by encoderer 18y ago
OK, I'll bite... I'm a co-founder of a software consultancy and we've actively marketed PHP4->PHP5 upgrades after we did a couple large, successful projects that just happened to include upgrading from 4 to 5.
We wrote a Compiler that does 95% of the work for us. Took a few weeks to write and it's made our 4->5 upgrade jobs a very profitable part of the business.
To the best of my knowledge, there was no changes to function parameters order. It's nearly all object-model stuff.
Some might find this interesting.. The 1.0 of the Compiler introduced bugs into the compiled (5.0 version) of the codebase in cases where the orginal dev relied on the Assign-By-Copy behavior of v4.
In most cases by-ref behavior is what was wanted, and many probably didn't notice the distinction. But there is a situation where the dev may have taken advantage of the fact that eh was getting a copy, eg:
function x($o) {
$o->foo = 'bar';
$o->save();
unset($o);
}
$y = new o();
$y->foo = 'baz';
x($y);
$y->save();
This code in PHP4 works as the developer intended. In PHP5 it throws an error on the $y->save line because the object was passed by reference to x() and it was garbage collected inside x.
It's rare, but it exists, and it was a little tough to fix because we're running a single-pass Compiler.
The nice thing is that it's also able to introduce optimizations in the code, as well as use a Static Analysis approach to detecting probably bugs and security holes (for example, unfiltered use of $_REQUEST values, or assigning to $this) and it fixes them as well.
The end result is an app that always runs faster, sometimes significantly so.
IMO, the real reason 4->5 was a slow process is because it's biggest selling point was a "real-ish" object model and most PHP developers are Morts and just don't need to care about that.
- nuclear_eclipse 18y ago> To the best of my knowledge, there was no changes to function parameters order. It's nearly all object-model stuff. Now that I think about it, I'm wanting to say the parameter-order hoopla was centered around one of the point releases to 5.x, but I could be wrong. Your compiler is an interesting topic though, and it seems similar to the "upgrade" scripts available for the Python 3 jump. Do you make the compiler publicly available, or no? Would be really nifty to see what all you handle in it.
- chops 18y agoI've venture a guess that "no, it's not publicly available", primarily since he mentioned that it's a very profitable part of his company.