Bug #66331 [Com]: ZEND_SEND_PREFER_REF issue trying to overlad
Edit report at https://bugs.php.net/bug.php?id=66331&edit=1
ID: 66331
Comment by: remi@php.net
Reported by: remi@php.net
Summary: ZEND_SEND_PREFER_REF issue trying to overlad
Status: Open
Type: Bug
Package: *General Issues
Operating System: irrevelant
PHP Version: 5.5.7
Block user comment: N
Private report: N
New Comment:
@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).
Previous Comments:
------------------------------------------------------------------------
[2013-12-20 17:56:24] remi@php.net
The following patch has been added/updated:
Patch Name: pass-by-ref-proto-check.patch
Revision: 1387562184
URL: https://bugs.php.net/patch-display.php?bug=66331&patch=pass-by-ref-proto-check.patch&revision=1387562184
------------------------------------------------------------------------
[2013-12-20 17:04:12] rdlowrey@php.net
Just tested krakjoe's patch -- works for me.
------------------------------------------------------------------------
[2013-12-20 16:06:30] krakjoe@php.net
The following patch has been added/updated:
Patch Name: pass-by-ref-recv-init.patch
Revision: 1387555590
URL: https://bugs.php.net/patch-display.php?bug=66331&patch=pass-by-ref-recv-init.patch&revision=1387555590
------------------------------------------------------------------------
[2013-12-20 14:46:52] remi@php.net
Description:
------------
When trying to overload a class, with function where parameters have ZEND_SEND_PREFER_REF
Ex : Memcached::get() in version 2.2.0b1
ZEND_BEGIN_ARG_INFO_EX(arginfo_get, 0, 0, 1)
ZEND_ARG_INFO(0, key)
ZEND_ARG_INFO(0, cache_cb)
ZEND_ARG_INFO(2, cas_token)
ZEND_ARG_INFO(1, udf_flags)
ZEND_END_ARG_INFO()
Real use case: try to mock the class using PHPUnit for test suite.
See https://github.com/symfony/symfony/issues/9797
Test script:
---------------
<?php
class MyMemcached extends memcached {
public function get($key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL)
{
}
}
Expected result:
----------------
No error.
Actual result:
--------------
Strict standards: Declaration of MyMemcached::get() should be compatible with
Memcached::get($key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL)
in /tmp/foo.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66331&edit=1
Thread (10 messages)