phpspec / prophecy

Highly opinionated mocking framework for PHP 5.3+
MIT License
8.53k stars 242 forks source link

Strict standards: Declaration of Double\... should be compatible with ... #310

Open DavidGarciaCat opened 7 years ago

DavidGarciaCat commented 7 years ago

Based on my previous issue, reported here https://github.com/phpspec/phpspec/issues/1053, looks like the Memcached mock for getByKey (and other methods) does not match the signature of the parent class.

PHP Strict standards:  Declaration of Double\Memcached\P8::getByKey() should be compatible with Memcached::getByKey($server_key, $key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL) in .../vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(49) : eval()'d code on line 2

My local environment is built with these specs:

PHP version:

$ php -v
PHP 5.5.38 (cli) (built: Oct  1 2016 23:03:00)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans
    with blackfire v1.14.1~mac-x64-non_zts55, https://blackfire.io, by Blackfireio Inc.

Installed PHP Spec version:

$ composer show phpspec/phpspec*
phpspec/phpspec 2.4.1 Specification-oriented BDD framework for PHP 5.3+

Installed Prophecy version:

$ composer show *prophecy*
phpspec/prophecy v1.4.1 Highly opinionated mocking framework for PHP 5.3+

Memcached version

$ memcached -V
memcached 1.4.33

Hope it helps to find the problem!

Regards,

stof commented 7 years ago

OK, please first updated Prophecy to 1.6.2. The 1.4.1 version is really old, and I won't provide debugging for it (we already fixed many things since then)

stof commented 7 years ago

please give the version of the PHP memcached extension, not of the memcached server (we don't care about it here as it does not provide PHP code). You can have this version in phpinfo(), and also in composer show -p if the extension exposes it properly

DavidGarciaCat commented 7 years ago

Hello @stof

I updated prophecy, as requested. However the error is still there.

$ composer update phpspec/prophecy

$ composer show *prophecy*
phpspec/prophecy v1.6.2 Highly opinionated mocking framework for PHP 5.3+

About the PHP Memcached version, these are the details (this is the latest version I can install via Homebrew - I checked yesterday if there were packages to upgrade):

$ composer show -p | grep memcached
ext-memcached       2.2.0     The memcached PHP extension
screen shot 2017-01-04 at 10 40 22

Hope this helps,

jakzal commented 7 years ago

This is probably caused by https://github.com/php-memcached-dev/php-memcached/issues/126 and https://bugs.php.net/bug.php?id=66331

DavidGarciaCat commented 7 years ago

Thanks for those links @jakzal

This should confirm the outputs that I am getting, indeed. Also, after a quick read, looks like there are no upcoming plans to fix it from Memcached side due those outputs are not breaking the system. That's sad...