modmore / Gitify

Command line toolkit to make managing a MODX site in git a lot easier.
MIT License
122 stars 55 forks source link

MODX 3 Autoload conflicts in Gitify #366

Closed sonicpunk closed 3 years ago

sonicpunk commented 3 years ago

Summary

This may be a general issue with MODX3 as we are moving to a composer based setup, but... I am getting this error when trying to run Gitify:

Fatal error: Uncaught Error: Call to undefined method Symfony\Component\Yaml\Dumper::setIndentation() in /home/gitify/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php:98
Stack trace:
#0 /home/gitify/src/Gitify.php(45): Symfony\Component\Yaml\Yaml::dump(Array, 4)
#1 /home/gitify/src/Command/ExtractCommand.php(304): modmore\Gitify\Gitify::toYAML(Array)
#2 /home/gitify/src/Command/ExtractCommand.php(212): modmore\Gitify\Command\ExtractCommand->generate(Object(modContext_mysql), Array)
#3 /home/gitify/src/Command/ExtractCommand.php(74): modmore\Gitify\Command\ExtractCommand->extractObjects('/var/www/html/_...', Array)
#4 /home/gitify/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): modmore\Gitify\Command\ExtractCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /home/gitify/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\ in /home/gitify/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php on line 98

Step to reproduce

We have an environment whereby Gitify is already installed for our projects. A docker image. Fitting MODX3 to this environment required us to run composer install within our MODX folder. After this, I attempted to run a Gitify extract command.

Observed behavior

If resulted in the error above.

Expected behavior

Would love it to work.

Environment

Gitify version 0.12.0, MODX version 3, Operating System Apache, MySQL version 5.6, PHP version 7.3, etc.

sonicpunk commented 3 years ago

Oh yeah Composer 2.1.3

Mark-H commented 3 years ago

So that happens on a clean (no packages or content) MODX3 install?

sonicpunk commented 3 years ago

That is an install with some modx extras as well. So not clean.

sonicpunk commented 3 years ago

I seem to have found the issue. We have a module using Yaml 4, which conflicts with Gitify because it is expecting Yaml version 2 and Gitify is directly calling a method in Yaml 2. If I deinstall this module, Gitify works again.

I wonder how MODX is going to handle this autoloading issue. This issue I see will be coming up again and again when other developers start developing extras with their own PHP library dependencies that could cause conflicts with other extras.

Mark-H commented 3 years ago

There's not really s solution for that, as long as each extra can define their own dependencies there'll occasionally be conflicts.

I'd very much welcome the help bringing gitify up to date, it's quite a bit behind.

Mark-H commented 3 years ago

Should be resolved by updating to v2; see the readme for instructions.