Re: Exceptions and Errors

From: Date: Thu, 15 Apr 2004 12:15:21 +0000
Subject: Re: Exceptions and Errors
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  Groups: php.internals 
Request: Send a blank email to internals+get-9178@lists.php.net to get a copy of this message
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

« previous php.internals (#9178) next »