Just to add some more thoughts to the ongoing discussion from a slightly different POV.

The PEAR devs are trying to slowly prepare their packages for PHP5 and so we also needed to address assignedments to $this in constructors in the few packages that do so.

http://pear.php.net/bugs/bug.php?id=829

Our original idea was to handle this with an if statement like so:
if (version_compare(phpversion(), "5.0.0") == -1) {
    // assign factoried method to this for PHP 4
    // $this =& <Your_Package_Name>::factory();
    $this =& <Your_Package_Name>::singleton();
} else {
    // error handling for PHP5
    // user has to use the factory()/singleton() method
}

But this will obviously not work either. So I really see no way to maintain BC for packages that have used this "feature" in PHP4.

Beyond that I also would like to go on record to say that just using OO doesnt mean you necessary want or even know how to deal with exceptions. And regarding logic in constructors its always problematic to start shooting your users for using something that used to work. I think its enough if we beat them with a stick for it. So I think for BC this "mistake" or use of a feature that was never intended should not result in such harsh BC issues.

regards,
Lukas

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to