chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
807 stars 481 forks source link

PHP Error on Update to 1.11.14 #3760

Open Craftoncu opened 3 years ago

Craftoncu commented 3 years ago

Describe Type Error after update from 1.11.11 to 1.11.14. Unzipped new files over old.

Stacktrace: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Gedmo\\Mapping\\MappedEventSubscriber::loadMetadataForObjectClass() must implement interface Doctrine\\Common\\Persistence\\ObjectManager, instance of Doctrine\\ORM\\EntityManager given, called in /var/www/campush.de/vendor/gedmo/doctrine-extensions/lib/Gedmo/AbstractTrackingListener.php on line 46 and defined in /var/www/campush.de/vendor/gedmo/doctrine-extensions/lib/Gedmo/Mapping/MappedEventSubscriber.php:196\nStack trace:\n#0 /var/www/campush.de/vendor/gedmo/doctrine-extensions/lib/Gedmo/AbstractTrackingListener.php(46): Gedmo\\Mapping\\MappedEventSubscriber->loadMetadataForObjectClass(Object(Doctrine\\ORM\\EntityManager), Object(Doctrine\\ORM\\Mapping\\ClassMetadata))\n#1 /var/www/campush.de/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php(59): Gedmo\\AbstractTrackingListener->loadClassMetadata(Object(Doctrine\\ORM\\Event\\LoadClassMetadataEventArgs))\n#2 /var/www/campush.de/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(246): Doctrine\\Common\\EventMana in /var/www/campush.de/vendor/gedmo/doctrine-extensions/lib/Gedmo/Mapping/MappedEventSubscriber.php on line 196

mk111 commented 3 years ago

same as #3736 did you empty caches ? and restarted web services? there is a possibility that some of the requirements missing due to a new versions of libraries included; here a list of php requirements from #3710 needed for new install ... waiting to be added to installation manual ...

lonesomewalker commented 3 years ago

Since i know whom you are working for...

For future "issues" please check this first: https://11.chamilo.org/documentation/installation_guide.html#3._Upgrade

Coursenligne commented 3 years ago

It looks like the info given in the case is not accurate. This sounds like the case here is the one described on the forum : https://forum.chamilo.org/viewtopic.php?f=52&t=11539 The user claims having trouble from Version 1.11.6 to 1.11.14. I was suspecting a PHP issue as, if my memory is good, 1.11.6 allowed PHP5, which is not working with 1.11.14.

mk111 commented 3 years ago

I'm sorry, I started from the fact that v11.14 on php 7.1+ de-facto works from clean installation: the upgrade process for minor versions is very straigtforward: overwrite existing files ... it overwrites all application scripts including the necessary libraries (symfony, doctrine, twig, zend,...). All the caches need to be cleaned too. On the system where the distribution was made, all dependencies between php / libraries were resolved. On the target system, however, this is not necessary. Note that the upgrade does not start any of the package managers/Composer to resolve any additional dependencies and whether the requirements for additional php modules and / or their versions are otherwise checked.

Coursenligne commented 3 years ago

I agree with You, but, as 1.11.6 was PHP 5 compliant, if the customer did install this version, it becomes impossible to upgrade 1.11.14 as only PHP7+ compliant. The PHP message let me think of this kind of mistake.

lonesomewalker commented 3 years ago

Sorry to bother both of you, but as you can read initially:

Type Error after update from 1.11.11 to 1.11.14

This is related to not correctly prepare for upgrade.

mk111 commented 3 years ago

i must agree with @lonesomewalker ; this part of the error i do not like : Doctrine\\Common\\Persistence\\ObjectManager Persistence is not part of the Common any more and should be located in vendor\doctrine\persistence ...

SebRevol commented 3 years ago

Hi all, I have the same issue after an update from 1.11.12 to 1.11.14. I followed the procedure described in https://11.chamilo.org/documentation/installation_guide.html#3._Upgrade which succesfully worked for my previous 1.11.10 to 1.11.12 update.

I'm very unexperimented in php, but I noticed that chamilo 1.11.14 archive contains both vendor/doctrine/persistence/lib/Doctrine/Persistence/ and vendor/doctrine/persistence/lib/Doctrine/Common/Persistence folders with quite similar php files in them (but that's also the case in 1.1.12 archive).

SebRevol commented 3 years ago

As suggested in #3736, deleting and replacing vendor directory fixed the issue.