Re: Please feedback for Zend bug #66331 ZEND_SEND_PREFER_REF issue trying to overlad
| From: | Nikita Popov | Date: | Sat, 04 Jan 2014 11:24:51 +0000 |
| Subject: | Re: Please feedback for Zend bug #66331 ZEND_SEND_PREFER_REF issue trying to overlad | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71000@lists.php.net to get a copy of this message | ||
On Sat, Jan 4, 2014 at 11:31 AM, Remi Collet <remi@fedoraproject.org> wrote:
> See https://bugs.php.net/bug.php?id=66331
> With PHPUnit real use cse (trying to mock memcached class)
>
> We have more options in Extension land that in user land.
>
> Of course if will be great to be able to correctly handle those arginfo
> mapping in userland, but we have, for now, no way to say "PREFER_REF" in
> PHP land.
>
> So my proposal is to make proto check a little less stric and consider
> ZEND_SEND_PREFER_REF as ZEND_SEND_REF, so this will allow to override a
> internal class method (using "prefer") in a php class.
>
>
> Any better idea ?
> Or could I apply this fix ?
>
Changing a prefer-ref argument into a by-ref argument via inheritance
violates LSP, so the code is right to refuse it. What I'd do instead is to
automatically convert userland by-ref arguments extending prefer-ref
arguments to also be prefer-ref. The resulting behavior might be a tad
unexpected, but I think that's better than allowing LSP violations here.
Nikita