contao / manager-plugin

Contao Manager Plugin
GNU Lesser General Public License v3.0
4 stars 9 forks source link

I think the new release (2.3 & 2.4) causes incompatiblities with PHP return types #16

Closed netzarbeiter closed 6 years ago

netzarbeiter commented 6 years ago

I'm using the post-release task from mage to clear the opcache. With the new version of the manager-plugin the task has failed.

[2018-07-09 13:25:24] magephp.DEBUG: Running task [Exec] Clearing Opcache (exec) [] []
[2018-07-09 13:25:24] magephp.INFO: ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ssh@domain.com "cd /home/user/public_html/domain.com/releases/20180709132456 && vendor/bin/contao-console cache:accelerator:clear --opcode" [] []
[2018-07-09 13:25:24] magephp.DEBUG:  Fatal error: Uncaught TypeError: Return value of Contao\ManagerPlugin\Bundle\Parser\DelegatingParser::addParser() must be an instance of Contao\ManagerPlugin\Bundle\Parser\void, none returned in /home/user/public_html/domain.com/releases/20180709132456/vendor/contao/manager-plugin/src/Bundle/Parser/DelegatingParser.php:30 Stack trace: #0 /home/user/public_html/domain.com/releases/20180709132456/vendor/contao/manager-bundle/src/HttpKernel/ContaoKernel.php(131): Contao\ManagerPlugin\Bundle\Parser\DelegatingParser->addParser(Object(Contao\ManagerPlugin\Bundle\Parser\JsonParser)) #1 /home/user/public_html/domain.com/releases/20180709132456/vendor/contao/manager-bundle/src/HttpKernel/ContaoKernel.php(227): Contao\ManagerBundle\HttpKernel\ContaoKernel->getBundleLoader() #2 /home/user/public_html/domain.com/releases/20180709132456/vendor/contao/manager-bundle/src/HttpKernel/ContaoKernel.php(53): Contao\ManagerBundle\HttpKernel\ContaoKernel->addBundlesFromPlugins(Array) #3 /home/user/public_html/domain.com in /home/user/public_html/domain.com/releases/20180709132456/vendor/contao/manager-plugin/src/Bundle/Parser/DelegatingParser.php on line 30  [] []
[2018-07-09 13:25:24] magephp.ERROR:  [] []
[2018-07-09 13:25:24] magephp.DEBUG: Task [Exec] Clearing Opcache (exec) finished with FAIL [] []

Going back to version 2.2 ("contao/manager-plugin": "2.2.*") did the trick for me.

Toflar commented 6 years ago

/cc @aschempp @leofeyer

leofeyer commented 6 years ago

Here is the error message and stack trace in a more readable format:

Fatal error: Uncaught TypeError: Return value of Contao\ManagerPlugin\Bundle\Parser\DelegatingParser::addParser() must be an instance of Contao\ManagerPlugin\Bundle\Parser\void, none returned in vendor/contao/manager-plugin/src/Bundle/Parser/DelegatingParser.php:30
#0 vendor/contao/manager-bundle/src/HttpKernel/ContaoKernel.php(131): Contao\ManagerPlugin\Bundle\Parser\DelegatingParser->addParser(Object(Contao\ManagerPlugin\Bundle\Parser\JsonParser))
#1 vendor/contao/manager-bundle/src/HttpKernel/ContaoKernel.php(227): Contao\ManagerBundle\HttpKernel\ContaoKernel->getBundleLoader()
#2 vendor/contao/manager-bundle/src/HttpKernel/ContaoKernel.php(53): Contao\ManagerBundle\HttpKernel\ContaoKernel->addBundlesFromPlugins(Array)
#3 /home/user/public_html/domain.com in vendor/contao/manager-plugin/src/Bundle/Parser/DelegatingParser.php on line 30
leofeyer commented 6 years ago

Since the PHP parses thinks that there is a Contao\ManagerPlugin\Bundle\Parser\void class, I figure you do not have PHP 7.1?

netzarbeiter commented 6 years ago

PHP Version 7.2.6 is running

leofeyer commented 6 years ago

Are you sure? Apparently PHP does not recognize the void keyword and thinks it refers to a class.

netzarbeiter commented 6 years ago

Sorry, PHP 5.6.

leofeyer commented 6 years ago

Ok. Still its weird that Composer gave you version 2.3 of the plugin, as it defines PHP 7.1 as minimum requirement: https://github.com/contao/manager-plugin/blob/2.3/composer.json#L13

netzarbeiter commented 6 years ago

After private lessons with Yanick, it works now. I had a mess of PHP versions:

Should I close the ticket?

leofeyer commented 6 years ago

In this case yes. 😄