views:

310

answers:

3

I have a legacy web application php4/mysql4 (MyISAM, db contains some cms, some user data, some calendar application). Now I am going to migrate to a new server with php5/mysql5.

What are the typical php issues in such a migration scenary (php, sql queries, anything)?

I've heard that the function parameter passing changed, call-by-reference / call-by-value. Can you give an example or explain?

Anything else I should be aware of?

(The mysql issues are covered in a different question: http://stackoverflow.com/questions/745787/migrating-php4-mysql4-to-php5-mysql5-switch-to-innodb)

+2  A: 

I think the best migration help is from the PHP guys themselves.

Ólafur Waage
+1  A: 

I'm in the middle of a migration and I'm finding lots of aliasing problems.

If you want to have a clean code, then you'll need to find the proper solution to your specific snippet. If cleanness is not that important, you might find this function really useful:

function php4_clone($object) {
 if (version_compare(phpversion(), '5.0') < 0) {
  return $object;
 } else {
  return @clone($object);
 }
}
Seb
+2  A: 

Most of the PHP 4/5 compatibility issues are two things:

  • new reserved words
  • new class/object backend

Most v4 code will run just fine in v5. Where you are likely to run up against problems is code that depends on the limitations of v4's class model or takes advantage of v4's reference quirks. But most people don't code up against those limits (I have - that's why I know they're there).

If you are stuck with the class/object limits, you can run the Zend engine in a "v1" mode which makes the classes and objects behave like in v4. This is documented.

staticsan