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

[ZF3][PHP7] Compatibility issues with PHP7 and Memcached #7742

Open
drgomesp opened this issue Oct 26, 2016 · 7 comments
Open

[ZF3][PHP7] Compatibility issues with PHP7 and Memcached #7742

drgomesp opened this issue Oct 26, 2016 · 7 comments
Labels

Comments

@drgomesp
Copy link

Hello everyone.

I'm currently running through the process of migrating my ZF2 application to ZF3. I got stuck in a nasty issue which I cannot get around.

Essentially, when Memcached is called for the first time during the application bootstrap phase, the extension throws a response error code (@see http://php.net/manual/en/memcached.getresultcode.php) RES_HOST_LOOKUP_FAILURE.

However, if I simply try to create a server and connect, set and get a key via php -a, I'm able to do it. Do we have support for ZF3 here? Or for Memcached?

@Ocramius
Copy link
Member

RES_HOST_LOOKUP_FAILURE seems quite clear - host can't be looked up at that point in time (for whatever reason).

Any stack traces/details about the failure?

@drgomesp
Copy link
Author

Well, that is not that clear as it looks like.

I've used the extension directly without the zf layer and it works fine. So I'm concluding that something changed in the way zf abstracts that from 2 to 3

Ill try to get a stack trace. In the mean time, any ideas on how to reproduce the error in a different way?

@Ocramius
Copy link
Member

We'd first need some stack trace or similar in order to know what the issue IS. So far, this looks like your server can't contact the host (DNS lookup failure).

@drgomesp
Copy link
Author

drgomesp commented Oct 26, 2016

@Ocramius, this is the most information I can get from ZF3 stack trace:

screenshot 2016-10-26 17 03 07

From what I could understand, it happens at the first time caching is called, for doctrine annotations.

That makes no sense, as I can normally connect to Memcached through the usage of the extension by itself.

@Ocramius
Copy link
Member

@drgomesp what's the factory for that service like?

@drgomesp
Copy link
Author

drgomesp commented Oct 26, 2016

public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
    /** @var ResizerUrl $resizerUrl */
    $resizerUrl = $container->get('ViewHelperManager')->get('resizerUrl');
    /** @var EntityManagerInterface $entityManager */
    $entityManager = $container->get('doctrine.entitymanager.orm_default');

    /** @var PageContentRepositoryInterface $repository */
    $repository = $entityManager->getRepository(PageContentEntity::class);

    /** @var MvcEvent $mvcEvent */
    $mvcEvent = $container->get('application')->getMvcEvent();
    /** @var Request $request */
    $request = $mvcEvent->getRequest();

    return new PageContent($repository, $resizerUrl, $mvcEvent->getRouteMatch(), $request->getRequestUri(), $container->get('Config'));
}

After the first call to $entityManager->getRepository(...), the error is thrown.

@Ocramius
Copy link
Member

Do you use redis caching via DoctrineModule's config?

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

No branches or pull requests

2 participants