0

A few months ago, we upgraded the intranet of our company from Symfony 2.3 to Symfony 2.8 and from PHP 5.6 to 7.0.10. Then, we encountered a lot of "Fatal Errors" due to circular references that could be "erased" by restarting Wampserver. I read that this could be because of passing some parameters to services. I corrected this by passing and setting as property only the container, even if I'm not convinced that this is a good practice. I also read that it could be because of opcache, so I disabled this.

After that, we no longer have this problem. However, since two weeks a new "Fatal error" appears randomly :

PHP Fatal error:  Class Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open) in C:\wamp\www\symfony\app\cache\prod\classes.php on line 393

or

PHP Fatal error:  Class Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in C:\wamp\www\symfony\app\cache\prod\classes.php on line 393

We just restart the server and it works. I saw that many people had a similar error, but I could not find any real solution. I don't know if it's a PHP error or if it's due to a Symfony 2.8 - PHP7 incompatibility, despite Symfony achieves 100% PHP7 compatibility or if it's an error in our code.

I will try to know if this error appear after a specific action on the intranet.

I hope my problem is a little different and someone will find a solution. If I forgot something or if you want to see another part of code say me !

My configuration :

  • Windows Server 2008 R2

  • WampServer 3.0.6 :

    • Apache 2.4.23
    • PHP 7.0.10
    • MySQL : 5.7.14
  • Symfony : 2.8.25

  • Composer :

    Composer version 1.5-dev (b07b4c3428a57b68e385ae3db0474e6c5400789b) 2017-04-28 09:25:51
    

composer.json :

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": { "": "src/" },
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    },
    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.8.*",
        "doctrine/orm": "^2.4.8",
        "doctrine/doctrine-bundle": "~1.4",
        "symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
        "symfony/monolog-bundle": "^3.0.2",
        "sensio/distribution-bundle": "~5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle": "v2.0.0-beta2",
        "friendsofsymfony/jsrouting-bundle": "dev-master",
        "liuggio/ExcelBundle": "2.0.*@dev",
        "knplabs/knp-snappy-bundle": "dev-master",
        "h4cc/wkhtmltopdf-amd64": "0.11.0-RC1",
        "symfony/intl": "^2.8",
        "symfony/property-access": "^3.2",
        "symfony/assetic-bundle": "^2.8"
    },
    "require-dev": {
        "sensio/generator-bundle": "~3.0",
        "escapestudios/symfony2-coding-standard": "~2.0"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ],
        "build-params": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
          ]
    },
    "config": {
        "bin-dir": "bin",
        "platform": {
            "php": "7.0.10"
        }
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.8-dev"
        }
    }
}

composer show :

composer/ca-bundle                     1.0.7
doctrine/annotations                   v1.4.0
doctrine/cache                         v1.6.1
doctrine/collections                   v1.4.0
doctrine/common                        v2.7.2
doctrine/dbal                          v2.5.12
doctrine/doctrine-bundle               1.6.8
doctrine/doctrine-cache-bundle         1.3.0
doctrine/inflector                     v1.1.0
doctrine/instantiator                  1.0.5
doctrine/lexer                         v1.0.1
doctrine/orm                           v2.5.6
escapestudios/symfony2-coding-standard 2.11.0
friendsofsymfony/jsrouting-bundle      dev-master 31462ad
friendsofsymfony/user-bundle           2.0.0-beta2
h4cc/wkhtmltopdf-amd64                 0.11.0-RC1
incenteev/composer-parameter-handler   v2.1.2
ircmaxell/password-compat              v1.0.4
jdorn/sql-formatter                    v1.2.17
knplabs/knp-snappy                     v0.5.0
knplabs/knp-snappy-bundle              dev-master 40b780f
kriswallsmith/assetic                  v1.4.0
liuggio/ExcelBundle                    dev-master a028c00
monolog/monolog                        1.23.0
paragonie/random_compat                v2.0.10
phpoffice/phpexcel                     1.8.1
psr/log                                1.0.2
sensio/distribution-bundle             v5.0.20
sensio/framework-extra-bundle          v3.0.26
sensio/generator-bundle                v3.1.6
sensiolabs/security-checker            v4.0.4
squizlabs/php_codesniffer              2.9.1
swiftmailer/swiftmailer                v5.4.8
symfony/assetic-bundle                 v2.8.2
symfony/inflector                      v3.3.5
symfony/monolog-bundle                 v3.1.0
symfony/polyfill-apcu                  v1.4.0
symfony/polyfill-intl-icu              v1.4.0
symfony/polyfill-mbstring              v1.4.0
symfony/polyfill-php54                 v1.4.0
symfony/polyfill-php55                 v1.4.0
symfony/polyfill-php56                 v1.4.0
symfony/polyfill-php70                 v1.4.0
symfony/polyfill-util                  v1.4.0
symfony/property-access                v3.3.5
symfony/security-acl                   v3.0.0
symfony/swiftmailer-bundle             v2.6.2
symfony/symfony                        v2.8.25
twig/twig                              v2.4.3
willdurand/jsonp-callback-validator    v1.1.0

EDIT :

The issue has just been reproduced, I saw it when I opened the intranet so I don't know if it crashed before or when I opened it. There are no logs in the prod.log of Symfony but, in php_error.log of wamp, there are two errors :

[31-Jul-2017 15:22:30 Europe/Paris] PHP Warning: session_regenerate_id(): Session object destruction failed. ID: user (path: C:\wamp\www\symfony\app/sessions) in C:\wamp\www\symfony\app\cache\prod\classes.php on line 156

[31-Jul-2017 15:22:30 Europe/Paris] PHP Stack trace:

[31-Jul-2017 15:22:30 Europe/Paris] PHP 1. {main}() C:\wamp\www\symfony\web\app.php:0

[31-Jul-2017 15:22:30 Europe/Paris] PHP 2. Symfony\Component\HttpKernel\Kernel->handle() C:\wamp\www\symfony\web\app.php:16

[31-Jul-2017 15:22:30 Europe/Paris] PHP 3. Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:185

[31-Jul-2017 15:22:30 Europe/Paris] PHP 4. Symfony\Component\HttpKernel\HttpKernel->handle() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel.php:69

[31-Jul-2017 15:22:30 Europe/Paris] PHP 5. Symfony\Component\HttpKernel\HttpKernel->handleRaw() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:64

[31-Jul-2017 15:22:30 Europe/Paris] PHP 6. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:125

[31-Jul-2017 15:22:30 Europe/Paris] PHP 7. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() C:\wamp\www\symfony\app\cache\prod\classes.php:1779

[31-Jul-2017 15:22:30 Europe/Paris] PHP 8. call_user_func:{C:\wamp\www\symfony\app\cache\prod\classes.php:1864}() C:\wamp\www\symfony\app\cache\prod\classes.php:1864

[31-Jul-2017 15:22:30 Europe/Paris] PHP 9. Symfony\Component\Security\Http\Firewall->onKernelRequest() C:\wamp\www\symfony\app\cache\prod\classes.php:1864

[31-Jul-2017 15:22:30 Europe/Paris] PHP 10. Symfony\Component\Security\Http\Firewall\LogoutListener->handle() C:\wamp\www\symfony\app\cache\prod\classes.php:2635

[31-Jul-2017 15:22:30 Europe/Paris] PHP 11. Symfony\Component\Security\Http\Logout\SessionLogoutHandler->logout() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\Security\Http\Firewall\LogoutListener.php:127

[31-Jul-2017 15:22:30 Europe/Paris] PHP 12. Symfony\Component\HttpFoundation\Session\Session->invalidate() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\Security\Http\Logout\SessionLogoutHandler.php:34

[31-Jul-2017 15:22:30 Europe/Paris] PHP 13. Symfony\Component\HttpFoundation\Session\Session->migrate() C:\wamp\www\symfony\app\cache\prod\classes.php:529

[31-Jul-2017 15:22:30 Europe/Paris] PHP 14. Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->regenerate() C:\wamp\www\symfony\app\cache\prod\classes.php:533

[31-Jul-2017 15:22:30 Europe/Paris] PHP 15. session_regenerate_id() C:\wamp\www\symfony\app\cache\prod\classes.php:156

And

[31-Jul-2017 15:30:50 Europe/Paris] PHP Fatal error: Class Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open, SessionHandlerInterface::close, SessionHandlerInterface::write) in C:\wamp\www\symfony\app\cache\prod\classes.php on line 393

[31-Jul-2017 15:30:50 Europe/Paris] PHP Stack trace:

[31-Jul-2017 15:30:50 Europe/Paris] PHP 1. {main}() C:\wamp\www\symfony\web\app.php:0

[31-Jul-2017 15:30:50 Europe/Paris] PHP 2. Symfony\Component\HttpKernel\Kernel->handle() C:\wamp\www\symfony\web\app.php:16

[31-Jul-2017 15:30:50 Europe/Paris] PHP 3. Symfony\Component\HttpKernel\Kernel->boot() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:182

[31-Jul-2017 15:30:50 Europe/Paris] PHP 4. Symfony\Component\HttpKernel\Kernel->doLoadClassCache() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:126

[31-Jul-2017 15:30:50 Europe/Paris] PHP 5. Symfony\Component\ClassLoader\ClassCollectionLoader::load() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:411

[31-Jul-2017 15:30:50 Europe/Paris] PHP 6. require_once() C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\ClassLoader\ClassCollectionLoader.php:96

EDIT 2 :

Arf, 2 circular references have reappeared :

[2017-08-01 15:41:00] request.CRITICAL: Exception thrown when handling an exception (Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "session", path: "session -> session.storage.native -> twig.controller.exception -> twig -> security.csrf.token_manager". at C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Container.php line 281) {"exception":"[object] (Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException(code: 0): Circular reference detected for service \"session\", path: \"session -> session.storage.native -> twig.controller.exception -> twig -> security.csrf.token_manager\". at C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Container.php:281)"} []

[2017-08-01 15:43:04] request.CRITICAL: Exception thrown when handling an exception (Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "fos_user.user_provider.username", path: "security.firewall.map.context.main -> security.authentication.rememberme.services.simplehash.main -> fos_user.user_provider.username -> fos_user.user_manager -> twig.controller.exception -> twig -> security.authorization_checker -> security.authentication.manager". at C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Container.php line 281) {"exception":"[object] (Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException(code: 0): Circular reference detected for service \"fos_user.user_provider.username\", path: \"security.firewall.map.context.main -> security.authentication.rememberme.services.simplehash.main -> fos_user.user_provider.username -> fos_user.user_manager -> twig.controller.exception -> twig -> security.authorization_checker -> security.authentication.manager\". at C:\wamp\www\symfony\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Container.php:281)"} []

Mathilde G.
  • 23
  • 1
  • 7

1 Answers1

2

We had the same problem using codeignaiter, and PHP 7.1.X I believe the error is related to an opcache (here!) extension bug.

After restarting apache the error did not occur.

I upgraded to php 7.2 and the problem did not occur any more.

Robson Piere
  • 161
  • 1
  • 7
  • Thanks ! We will try to upgrade to the 7.2 version. We also think the PDO SQL Server extension we use is in question because it was tested only on EasyPHP and not on Wamp Server. – Mathilde G. Dec 18 '17 at 18:30