-
1
- #1
to all who use php's OO functionality: beware of a nasty trap in php 5.3.3 +
if you have a class in a namespace then you can no longer rely on the php4 method of creating constructors.
this should not matter to those who are not coding for backwards compatible apps since you will, by now, be using proper constructors (and, of course, namespaces are not supported). However it remains a pitfall for people who have not updated their coding style.
e.g.
if you have a class in a namespace then you can no longer rely on the php4 method of creating constructors.
this should not matter to those who are not coding for backwards compatible apps since you will, by now, be using proper constructors (and, of course, namespaces are not supported). However it remains a pitfall for people who have not updated their coding style.
e.g.
Code:
namespace myNameSpace;
class myClass{
public function myClass(){
//in previous versions of php this (same name as class) would considered a constructor if there were no __constructor method.
// in php 5.3.3 this is treated as a regular method and will need to be called explicitly.
// so the bottom line is that now, at least, is the time that you should move to proper __construct() methods
}
}