2

I recently upgraded from Symfony 6.2 to 6.3 on both my development and production servers, and everything went swimmingly up until the point that I needed to clear the cache on the product server, whereupon I received the following output.

$ php bin/console cache:clear --env=prod

 // Clearing the cache for the prod environment with debug false

[2023-06-16T09:05:26.482252+00:00] deprecation.INFO: User Deprecated: Since symfony/doctrine-bridge 6.3: Using Doctrine subscribers as services is deprecated, declare listeners instead {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since symfony/doctrine-bridge 6.3: Using Doctrine subscribers as services is deprecated, declare listeners instead at /var/www/stuffin.fairmont.local/vendor/symfony/doctrine-bridge/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php:109)"} []
[2023-06-16T09:05:28.157486+00:00] deprecation.INFO: User Deprecated: Since symfony/doctrine-bridge 6.3: Using Doctrine subscribers as services is deprecated, declare listeners instead {"exception":"[object] (ErrorException(code: 0): User Deprecated: Since symfony/doctrine-bridge 6.3: Using Doctrine subscribers as services is deprecated, declare listeners instead at /var/www/stuffin.fairmont.local/vendor/symfony/doctrine-bridge/ContainerAwareEventManager.php:195)"} []
[2023-06-16T09:05:28.191619+00:00] deprecation.INFO: User Deprecated: Doctrine\DBAL\Platforms\AbstractPlatform::usesSequenceEmulatedIdentityColumns is deprecated. (AbstractPlatform.php:3945 called by ClassMetadataFactory.php:626, https://github.com/doctrine/dbal/pull/5513, package doctrine/dbal) {"exception":"[object] (ErrorException(code: 0): User Deprecated: Doctrine\\DBAL\\Platforms\\AbstractPlatform::usesSequenceEmulatedIdentityColumns is deprecated. (AbstractPlatform.php:3945 called by ClassMetadataFactory.php:626, https://github.com/doctrine/dbal/pull/5513, package doctrine/dbal) at /var/www/website.local/vendor/doctrine/deprecations/lib/Doctrine/Deprecations/Deprecation.php:209)"} []

 [OK] Cache for the "prod" environment (debug=false) was successfully cleared.

This then makes the production server respond to all requests with a 500 Internal Server Error, and the only way to fix it is to rm -rf /var/cache/prod/* and clear the cache again.

I have gone through every single file in vendor/symfony/doctrine-bundle, vendor/doctrine folders, and removed any files that are no longer present on the development server (which went through the normal composer update process), I also checked that all the new and updated files were present (which they are).

I'm not sure where to look next to fix this issue, I include my composer.json file below:

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": ">=8.1",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.5",
        "doctrine/annotations": "^2.0",
        "doctrine/doctrine-bundle": "*",
        "doctrine/doctrine-migrations-bundle": "*",
        "doctrine/orm": "^2.15",
        "phpdocumentor/reflection-docblock": "^5.2",
        "stof/doctrine-extensions-bundle": "^1.5.0",
        "symfony/asset": "6.3.*",
        "symfony/console": "6.3.*",
        "symfony/dotenv": "6.3.*",
        "symfony/expression-language": "6.3.*",
        "symfony/flex": "^2",
        "symfony/form": "6.3.*",
        "symfony/framework-bundle": "6.3.*",
        "symfony/http-client": "6.3.*",
        "symfony/intl": "6.3.*",
        "symfony/mailer": "6.3.*",
        "symfony/mime": "6.3.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/notifier": "6.3.*",
        "symfony/password-hasher": "6.3.*",
        "symfony/process": "6.3.*",
        "symfony/property-access": "6.3.*",
        "symfony/property-info": "6.3.*",
        "symfony/proxy-manager-bridge": "6.3.*",
        "symfony/runtime": "6.3.*",
        "symfony/security-bundle": "6.3.*",
        "symfony/serializer": "6.3.*",
        "symfony/string": "6.3.*",
        "symfony/translation": "6.3.*",
        "symfony/twig-bundle": "6.3.*",
        "symfony/validator": "6.3.*",
        "symfony/web-link": "6.3.*",
        "symfony/webpack-encore-bundle": "^1.12",
        "symfony/yaml": "6.3.*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "phpunit/phpunit": "^10.0",
        "rector/rector": "^0.15.21",
        "symfony/browser-kit": "6.3.*",
        "symfony/css-selector": "6.3.*",
        "symfony/debug-bundle": "6.3.*",
        "symfony/maker-bundle": "^1.0",
        "symfony/phpunit-bridge": "^6.3",
        "symfony/stopwatch": "6.3.*",
        "symfony/var-dumper": "6.3.*",
        "symfony/web-profiler-bundle": "6.3.*"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "allow-plugins": {
            "symfony/flex": true,
            "symfony/runtime": true
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "6.3.*"
        }
    }
}

Any advice will be greatly appreciated.

fearfelt
  • 91
  • 8
  • Further study of this suggest to me that these are effectively bugs in the vendor packages, so my plan is to keep updating my packages and hope that over time these problems will go away, – fearfelt Jun 19 '23 at 08:58
  • 2
    composer update seams to fix the problem today (with doctrine/dbal 3.6.3 => 3.6.4) – Didier Corbière Jun 25 '23 at 19:18
  • I have run composer update today and received doctrine/dbal 3.6.4 but I'm still getting the same deprecation info regarding symfony/doctrine-bridge (which updated 6.3.0 => 6.3.1). The third deprecation message has however gone away. I still get the 500 Errors after clearing the cache without using 'rm -rf' – fearfelt Jun 28 '23 at 12:15
  • 1
    Actually, these deprecation messages are from the same line in the first notice, and a different line but the same file in the second notice ('Using Doctrine subscribers as services'). I think it's just another wait on the packages to be updated again. – fearfelt Jun 28 '23 at 12:31
  • I have also throughly checked my project for any use of Doctrine EVent Subscribers and I only appear to be using Doctrine Lifecycle Callbacks as described in "Doctrine Events (Symfony Docs)", although the docs don't state whether Callbacks are a type of listener or subscriber... – fearfelt Jun 28 '23 at 15:45
  • I just switched one of my Entity classes from using LifeCycleCallbacks to using a Doctrine Entity Listener to see if it reduced the number of deprecation messages I get. But rather than seeing what I was expecting (either the same number of messages or less), I'm actually seeing an increase in deprecation messages! It'd be funny if it wasn't so frustrating. – fearfelt Jun 29 '23 at 15:58
  • 1
    I have this exact issue since upgrading to 6.3 a little over a week ago. This might shed some light for you, but I'm currently in the spam-composer-up-until-it-does-away mode. https://github.com/symfony/symfony/issues/49586https://github.com/symfony/symfony/issues/49586 – David Jun 30 '23 at 12:21
  • Thank you for the comment, David, however it would appear that the link you have provided leads to a 404 Error. – fearfelt Jul 03 '23 at 08:58
  • 1
    @fearfelt , https://github.com/symfony/symfony/issues/49586 – Mik Jul 11 '23 at 17:15

1 Answers1

1

This issue, as suspected has finally gone away, and as noted in the comments previously, continually spamming composer update eventually fixed it.

The potentially related packages that were updated are as follows:

doctrine/dbal (3.6.4 => 3.6.5)

doctrine/collections (2.1.2 => 2.1.3)

doctrine/orm (2.15.3 => 2.15.4)

I still receive a deprecation message elsewhere from the doctrine packages, but we can safely assume that this will be fixed later with further judicious usage of composer update

fearfelt
  • 91
  • 8