Symfony Fatal Error

Symfony is working correctly, but I get this error after opening in the browser. My whole controller is empty. Answer

FatalThrowableError

Type error: Return value of Doctrine\Common\Annotations\AnnotationRegistry::registerLoader() must be an instance of Doctrine\Common\Annotations\void, none returned

Here is my configuration file, I use several databases

# Doctrine Configuration
doctrine:
    dbal:
        default_connection: admin
        connections:
            admin:
                driver: pdo_mysql
                host: '%database_host%'
                port: '%database_port%'
                dbname: '%database_name%'
                user: '%database_user%'
                password: '%database_password%'
                charset: UTF8
            public_branch:
                driver: pdo_mysql
                host: '%database_host1%'
                port: '%database_port1%'
                dbname: '%database_name1%'
                user: '%database_user1%'
                password: '%database_password1%'
                charset: UTF8

    orm:
        auto_generate_proxy_classes: '%kernel.debug%'
        default_entity_manager: admin
        entity_managers:
            admin:
                connection: admin
                auto_mapping: true
            public_branch:
                connection: public_branch
                mappings:
                    AdminBundle: ~
                    PublicBranchBundle: ~

What can I do?

+6
source share
4 answers

I solved this problem by updating my php from 7.0 to 7.1 using the following commands:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1-curl php7.1-xml php7.1-zip php7.1-gd php7.1-mysql php7.1-mbstring php7.1
+8
source

Unfortunately, not every updated prod server can be simply updated.

Recent updates to Doctrine require PHP 7.1. .

You can lower the ORM to 2.5, and necessarily annotations to 1.4 :

    "doctrine/orm": "2.5.6",
    "doctrine/annotations": "1.4.*",
    "doctrine/dbal": "2.5.4",

, PHP 7.0.

+12

, PHP 7.1 PHP 7.1 apache2

$ sudo a2enmod php7.1

PHP 7.0 - :

$ sudo a2dismod php7.0
+10

- , php 7.1,

composer update

/ 1.5 1.4, php < 7.1

+1

All Articles