dropping support for conditional class declartion

From: Date: Fri, 02 Jan 2004 15:43:44 +0000
Subject: dropping support for conditional class declartion
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-6745@lists.php.net to get a copy of this message
helly@php.net wrote:
As Derick said. Previous Comments: ------------------------------------------------------------------------ [2004-01-02 05:56:39] derick@php.net I don't think that anything is broken here. You just can't have a conditional class definition (just like you can't instantiate a class before it's declared anymore).
Is there absolutely no way to keep this, apart from the example below, It will probably break a huge number of not amazingly well written scripts...... The code below is a nasty enough kludge to deal with overload method changes, but removing support for conditional classes makes it even worse.. - either an eval or include I guess........ if ( substr(phpversion(),0,1) == 5) {
    class DB_DataObject_Overload {
        function __call($method,$args) {
            $return = null;
            $this->_call($method,$args,$return);
            return $return;
        }
    }
} else {
    class DB_DataObject_Overload {
        function __call($method,$args,&$return) {
            return $this->_call($method,$args,$return);;
        }
    }
} Regards Alan

« previous php.internals (#6745) next »