Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

PHP Strict Standards errors #20

Closed
titouan13 opened this issue Apr 9, 2014 · 24 comments
Closed

PHP Strict Standards errors #20

titouan13 opened this issue Apr 9, 2014 · 24 comments

Comments

@titouan13
Copy link

Hi,

When I upload my website folder on my server, I got this error for almost every function of LswMemcacheBundle:

PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::replace() should be compatible with Memcached::replace($key, $value, $expiration = NULL, $udf_flags = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 501

I don't want to disable logs for debugging purpose.
I use php 5.5.11 and memcached 1.4.13

Thank you :-)

@raztud
Copy link

raztud commented Apr 9, 2014

Hi,
Can you run this code on the machine where you have this issue:

getVersion()); $reflector = new ReflectionClass('Memcached'); foreach ($reflector->getMethod('replace')->getParameters() as $param) { var_dump((string) $param); } ?>

I'm asking this because replace(), in version < 2.x, should have the signature without $udf_flags.

@mevdschee
Copy link
Contributor

I added a 1.2.6 tag.. did that help?

@titouan13
Copy link
Author

Here is the result:
string(5) "2.2.0"
string(32) "Parameter #0 [ $key ]"
string(34) "Parameter #1 [ $value ]"
string(39) "Parameter #2 [ $expiration ]"
string(38) "Parameter #3 [ $udf_flags ]"

@mevdschee
Copy link
Contributor

Did you update? Is it fixed?

@raztud
Copy link

raztud commented Apr 9, 2014

So, the memcached library version is 2.2.0. In this case, use 1.2.6 tag, indicated by Maurits.

@mevdschee
Copy link
Contributor

Thank you Razvan :-)

@titouan13
Copy link
Author

No sorry I updated my vendors but I still have the same problem.
I just updated my php install this morning. Maybe this is the problem.

@mevdschee
Copy link
Contributor

Can you try this again?

@titouan13
Copy link
Author

I still have the problem. It appears when I use any doctrine command like
php app/console doctrine:cache:clear-metadata

Maybe it's doctrine. In my composer.json, I have:
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",

@mevdschee
Copy link
Contributor

I made a new tag v1.2.7

If the interface in ./Resources/codegen/memcached-2.2.0/memcached-api.php is correct then it should run without errors. Let me know.

@titouan13
Copy link
Author

I still have the same error. Here is the full list:
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::get() should be compatible with Memcached::get($key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::getByKey() should be compatible with Memcached::getByKey($server_key, $key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::getMulti() should be compatible with Memcached::getMulti(array $keys, &$cas_tokens = NULL, $flags = NULL, &$udf_flags = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::getMultiByKey() should be compatible with Memcached::getMultiByKey($server_key, array $keys, &$cas_tokens = NULL, $flags = NULL, &$udf_flags = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::touchbyKey() should be compatible with Memcached::touchByKey($server_key, $key, $expiration) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::append() should be compatible with Memcached::append($key, $value, $expiration = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::appendByKey() should be compatible with Memcached::appendByKey($server_key, $key, $value, $expiration = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::prepend() should be compatible with Memcached::prepend($key, $value, $expiration = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::prependByKey() should be compatible with Memcached::prependByKey($server_key, $key, $value, $expiration = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::deleteMulti() should be compatible with Memcached::deleteMulti($keys, $time = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::deleteMultiByKey() should be compatible with Memcached::deleteMultiByKey($server_key, $keys, $time = NULL) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::setOptions() should be compatible with Memcached::setOptions($options) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326
PHP Strict Standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::setBucket() should be compatible with Memcached::setBucket($host_map, $forward_map, $replicas) in XXX/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 1326

I also have one on my local machine with 2.1.0:
Strict standards: Declaration of Lsw\MemcacheBundle\Cache\LoggingMemcache::setOptions() should be compatible with Memcached::setOptions($options) in XXX/www/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php on line 858

Call Stack:
0.0004 230240 1. {main}() XXX/www/app/console:0
0.0434 2635880 2. Symfony\Component\Console\Application->run() XXX/www/app/console:27
0.0471 2839296 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() XXX/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
0.2181 10824576 4. Symfony\Component\Console\Application->doRun() XXX/www/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
0.2184 10825464 5. Symfony\Component\Console\Application->doRunCommand() XXX/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
0.2223 10983792 6. Symfony\Component\Console\Command\Command->run() XXX/www/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:899
0.2228 10989040 7. Doctrine\Bundle\DoctrineBundle\Command\Proxy\UpdateSchemaDoctrineCommand->execute() XXX/www/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:241
0.2231 11001048 8. Doctrine\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper::setApplicationEntityManager() XXX/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/UpdateSchemaDoctrineCommand.php:69
0.2248 11123968 9. Doctrine\Common\Persistence\AbstractManagerRegistry->getManager() XXX/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/DoctrineCommandHelper.php:37
0.2248 11124016 10. Symfony\Bridge\Doctrine\ManagerRegistry->getService() XXX/www/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php:185
0.2248 11124016 11. Symfony\Component\DependencyInjection\Container->get() XXX/www/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ManagerRegistry.php:35
0.2249 11124872 12. appDevDebugProjectContainer->getDoctrine_Orm_DefaultEntityManagerService() XXX/www/app/bootstrap.php.cache:2037
0.2391 12207392 13. Symfony\Component\DependencyInjection\Container->get() XXX/www/app/cache/dev/appDevDebugProjectContainer.php:870
0.2392 12207840 14. appDevDebugProjectContainer->getDoctrine_Orm_DefaultMetadataCacheService() XXX/www/app/bootstrap.php.cache:2037
0.2401 12276944 15. Symfony\Component\DependencyInjection\Container->get() XXX/www/app/cache/dev/appDevDebugProjectContainer.php:913
0.2401 12277360 16. appDevDebugProjectContainer->getMemcache_DefaultService() XXX/www/app/bootstrap.php.cache:2037
0.2401 12277640 17. spl_autoload_call() XXX/www/app/bootstrap.php.cache:2253
0.2401 12277704 18. Symfony\Component\Debug\DebugClassLoader->loadClass() XXX/www/app/bootstrap.php.cache:0
0.2403 12293968 19. require('XXX/www/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/AntiDogPileMemcache.php') XXX/www/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:120
0.2403 12294296 20. spl_autoload_call() XXX/www/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:8
0.2403 12294360 21. Symfony\Component\Debug\DebugClassLoader->loadClass() XXX/www/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:0
0.2498 13613808 22. require('XXX/www/vendor/leaseweb/memcache-bundle/Lsw/MemcacheBundle/Cache/LoggingMemcache.php') XXX/www/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:120

I can temporarily disable errors by setting error_reporting(E_ERROR | E_WARNING | E_PARSE); in my AppKernel.php

@titouan13 titouan13 reopened this Apr 11, 2014
@mevdschee
Copy link
Contributor

I will send an update today..

@mevdschee
Copy link
Contributor

I made a new tag v1.2.8

It fixes the signature of setOptions() and touchbyKey()

@titouan13
Copy link
Author

It's better but now on 2.1.0, I have the same error on the following functions:
Lsw\MemcacheBundle\Cache\LoggingMemcache::decrement() should be compatible with Memcached::decrement($key, $offset = NULL, $initial_value = NULL, $expiry = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::increment() should be compatible with Memcached::increment($key, $offset = NULL, $initial_value = NULL, $expiry = NULL)

Concerning the 2.2.0:
Lsw\MemcacheBundle\Cache\LoggingMemcache::get() should be compatible with Memcached::get($key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::getByKey() should be compatible with Memcached::getByKey($server_key, $key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::getMulti() should be compatible with Memcached::getMulti(array $keys, &$cas_tokens = NULL, $flags = NULL, &$udf_flags = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::getMultiByKey() should be compatible with Memcached::getMultiByKey($server_key, array $keys, &$cas_tokens = NULL, $flags = NULL, &$udf_flags = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::append() should be compatible with Memcached::append($key, $value, $expiration = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::appendByKey() should be compatible with Memcached::appendByKey($server_key, $key, $value, $expiration = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::prepend() should be compatible with Memcached::prepend($key, $value, $expiration = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::prependByKey() should be compatible with Memcached::prependByKey($server_key, $key, $value, $expiration = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::deleteMulti() should be compatible with Memcached::deleteMulti($keys, $time = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::deleteMultiByKey() should be compatible with Memcached::deleteMultiByKey($server_key, $keys, $time = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::setBucket() should be compatible with Memcached::setBucket($host_map, $forward_map, $replicas)

Thank you very much for your after-sales service :-)

@mevdschee
Copy link
Contributor

Thank you for the detailed reports. I will fix these right away. It is unfortunate that the extensions documentation is incorrect. I will make sure the documents are corrected when we are done. Thank you for helping me improve the product :-)

@mevdschee
Copy link
Contributor

v1.2.11 released.. still some problems, but we are slowly getting there.. :-)

@mevdschee
Copy link
Contributor

Can you let me know your output with the latest version?

@titouan13
Copy link
Author

With 2.1.0, no more errors :-)

With 2.2.0, only 4 remains:
Lsw\MemcacheBundle\Cache\LoggingMemcache::get() should be compatible with Memcached::get($key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::getByKey() should be compatible with Memcached::getByKey($server_key, $key, $cache_cb = NULL, &$cas_token = NULL, &$udf_flags = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::getMulti() should be compatible with Memcached::getMulti(array $keys, &$cas_tokens = NULL, $flags = NULL, &$udf_flags = NULL)
Lsw\MemcacheBundle\Cache\LoggingMemcache::getMultiByKey() should be compatible with Memcached::getMultiByKey($server_key, array $keys, &$cas_tokens = NULL, $flags = NULL, &$udf_flags = NULL)

@mevdschee
Copy link
Contributor

hmmm.. a case of this bug it seems:

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

I have mailed the authors Andrei Zmievski and Mikko Koppanen.

See: http://pecl.php.net/package/memcached

@mkoppanen
Copy link

The following issue tracks this in memcached extension: php-memcached-dev/php-memcached#126. Inherently this is an issue with PHP and how the argument hinting is handled.

@mevdschee
Copy link
Contributor

So, it boils down to a bug in PHP. The author of php-memcached (@mkoppanen) was not willing to program around this bug, as you can read above. Maybe the warnings can be fixed in some future version of this bundle, but not trivially.

@mevdschee
Copy link
Contributor

Duplicate of issue #21

@titouan13
Copy link
Author

Thank you for your replies and for your help!

I can avoid the issue by disabling strict errors in symfony. I just need to add this line in the AppKernel.php
error_reporting(E_ERROR | E_WARNING | E_PARSE);

@mevdschee
Copy link
Contributor

No problem, I do what I can.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants