# Please feedback for Zend bug #66331 ZEND_SEND_PREFER_REF issue trying to overlad

- Thread: https://externals.io/message/70999
- Original archive: https://news-web.php.net/php.internals/70999
- Started by Remi Collet on 2014-01-04T10:31:52+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #70999 — Remi Collet — 2014-01-04T10:31:52+00:00

URL: https://externals.io/message/70999#70999

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 ?

Remi.

---

## #71000 — Nikita Popov — 2014-01-04T11:24:51+00:00

URL: https://externals.io/message/70999#71000 · In reply to: #70999

> 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
