Bug #66331 [Opn->Wfx]: ZEND_SEND_PREFER_REF issue trying to overlad

From: Date: Fri, 23 Jul 2021 10:23:13 +0000
Subject: Bug #66331 [Opn->Wfx]: ZEND_SEND_PREFER_REF issue trying to overlad
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235296@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66331&edit=1

 ID:                 66331
 Updated by:         nikic@php.net
 Reported by:        remi@php.net
 Summary:            ZEND_SEND_PREFER_REF issue trying to overlad
-Status:             Open
+Status:             Wont fix
 Type:               Bug
 Package:            *General Issues
 Operating System:   irrevelant
 PHP Version:        5.5.7
 Block user comment: N
 Private report:     N

 New Comment:

As we don't support this passing mode for userland code, it's not possible to inherit from
such a method while being compatible -- you'll always introduce incorrect behavior either for
value or references.

Do not use PREFER_REF on non-final methods.


Previous Comments:
------------------------------------------------------------------------
[2014-10-09 15:53:31] mkoppanen@php.net

@krakjoe: Is there anything preventing the patch you provided to be merged?

------------------------------------------------------------------------
[2013-12-21 05:39:03] datibbaw@php.net

Tested krakjoe's patch as well with the following result:

string(33) "ConcreteInNature::methodByRefInit"

------------------------------------------------------------------------
[2013-12-20 19:33:19] krakjoe@php.net

Here is some test code that shows the patch to compiler is correct:

http://pastebin.com/VFjwL0bv

You can make that error in the way you expect, if the prototype does not match exactly.

------------------------------------------------------------------------
[2013-12-20 19:29:57] krakjoe@php.net

the patch is correct, what is not correct is the arg info in memcached extension.

however, it is not currently possible to write the arginfo with the current macros, the correct
arginfo as it is expected is:

ZEND_BEGIN_ARG_INFO_EX(arginfo_get, 0, 0, 1)
	ZEND_ARG_INFO(0, key)
	{ "cache_cb", sizeof("cache_cb")-1, NULL, 0, 0, 1, 0},
	{ "cas_token", sizeof("cas_token")-1, NULL, 0, 0, 1, 2},
	{ "udf_flags", sizeof("udf_flags")-1, NULL, 0, 0, 1, 2}
ZEND_END_ARG_INFO()

To hide the symptoms is not enough, the arg_info must reflect what is actually required, it should
be parsed, and have a way to be specified in C correctly.

------------------------------------------------------------------------
[2013-12-20 17:59:57] remi@php.net

@krackjoe, thanks, but with your patch applied on 5.5.7, this doesn't change the result of
provided case.

A simple fix, see "pass-by-ref-proto-check.patch" just make
zend_do_perform_implementation_check a little less strict, and consider pass_by_reference as a
boolean (so consider 1 and 2 as equivalent, for the proto check).

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=66331


--
Edit this bug report at https://bugs.php.net/bug.php?id=66331&edit=1


Thread (10 messages)

« previous php.bugs (#235296) next »