Re: Detect zval instance of class/subclass

From: Date: Thu, 23 Sep 2010 12:05:08 +0000
Subject: Re: Detect zval instance of class/subclass
References: 1 2 3  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-7681@lists.php.net to get a copy of this message
On Thu, 2010-09-23 at 11:45 +0100, Mark Skilbeck wrote: > Thanks. Johannes. > > Although the problem was with allowing an object that could be an > instance of *two* different classes. I used the instanceof_function > against the two class entries, so that I could include any extending > classes also. That could be done with zpp, too: if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "O", &o, ce1) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &o, ce2) == FAILURE) { return; } } (untested) But this sounds more like a bad design and you rather should add an interface for the two variants. johannes

« previous php.pecl.dev (#7681) next »