Re: Forbid binding methods to incompatible $this
| From: | Dmitry Stogov | Date: | Wed, 30 Mar 2016 20:15:32 +0000 |
| Subject: | Re: Forbid binding methods to incompatible $this | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92031@lists.php.net to get a copy of this message | ||
On 03/30/2016 10:46 PM, Nikita Popov wrote:
On Wed, Mar 30, 2016 at 6:18 PM, Dmitry Stogov <dmitry@zend.com <mailto:dmitry@zend.com>> wrote:thank you for discovering this. Of course we can't drop or change SPL behavior. Trampoline looks like a possible but too complex solution. anyway, it would be great to remove this hack. Thanks. Dmitry.Great it's not used anymore 😊I personally agree to remove this.Nikita, can you also investigate the need for double pointer to object intypedef union _zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const zval *key);As I remember, it's necessary only for some SPL hack, and looks like a terrible design decision.This is used for forwarding method calls to the the "inner" object in SPL iterators. It's basically the internal equivalent of doing: function __call($method, $args) {return $this->inner->$method(...$args);} I don't think we can drop this feature at this point (deprecate?). We can of course change the implementation to use a trampoline function to avoid the zend_object** hack, but I'm not sure that would be worthwhile.
Nikita