CouscousPHP / Couscous

Couscous is good.
https://couscous.io
Other
840 stars 104 forks source link

Undefined function DI\object() when running couscous preview #216

Open chrisforrence opened 6 years ago

chrisforrence commented 6 years ago

Going off of the Getting Started page, I started by installing couscous/couscous globally, which pulled in 1.6.1 (released March 2017).

$ composer global require couscous/couscous
Changed current directory to /Users/chris/.composer
Using version ^1.6 for couscous/couscous
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 19 installs, 0 updates, 0 removals
  - Installing composer/ca-bundle (1.1.2): Downloading (100%)         
  - Installing padraic/humbug_get_contents (1.1.2): Loading from cache
  - Installing padraic/phar-updater (v1.0.6): Loading from cache
  - Installing php-di/phpdoc-reader (2.1.0): Downloading (100%)         
  - Installing nikic/php-parser (v3.1.5): Loading from cache
  - Installing symfony/polyfill-util (v1.9.0): Downloading (100%)         
  - Installing symfony/polyfill-php56 (v1.9.0): Downloading (100%)         
  - Installing jeremeamia/superclosure (2.4.0): Downloading (100%)         
  - Installing php-di/php-di (5.4.4): Downloading (100%)         
  - Installing erusev/parsedown (1.7.1): Loading from cache
  - Installing symfony/yaml (v3.4.14): Downloading (100%)         
  - Installing mnapoli/front-yaml (1.6.0): Loading from cache
  - Installing phine/exception (1.0.0): Downloading (100%)         
  - Installing phine/path (1.1.0): Downloading (100%)         
  - Installing phine/observer (2.0.1): Downloading (100%)         
  - Installing phine/phar (1.0.2): Downloading (100%)         
  - Installing erusev/parsedown-extra (0.7.1): Loading from cache
  - Installing twig/twig (v1.35.4): Downloading (100%)         
  - Installing couscous/couscous (1.6.1): Downloading (100%)         
php-di/php-di suggests installing doctrine/annotations (Install it if you want to use annotations (version ~1.2))
php-di/php-di suggests installing ocramius/proxy-manager (Install it if you want to use lazy injection (version ~2.0))
Package phine/exception is abandoned, you should avoid using it. No replacement was suggested.
Package phine/path is abandoned, you should avoid using it. No replacement was suggested.
Package phine/observer is abandoned, you should avoid using it. No replacement was suggested.
Package phine/phar is abandoned, you should avoid using it. Use box-project/box2 instead.
Writing lock file
Generating autoload files

However, when I went to run couscous preview, I got the following fatal error:

$ couscous preview
PHP Fatal error:  Uncaught Error: Call to undefined function DI\object() in /Users/chris/.composer/vendor/couscous/couscous/src/Module/Markdown/config.php:5
Stack trace:
#0 /Users/chris/.composer/vendor/php-di/php-di/src/Definition/Source/DefinitionFile.php(59): require()
#1 /Users/chris/.composer/vendor/php-di/php-di/src/Definition/Source/DefinitionFile.php(38): DI\Definition\Source\DefinitionFile->initialize()
#2 /Users/chris/.composer/vendor/php-di/php-di/src/Definition/Source/SourceChain.php(53): DI\Definition\Source\DefinitionFile->getDefinition('Symfony\\Compone...')
#3 /Users/chris/.composer/vendor/php-di/php-di/src/Container.php(164): DI\Definition\Source\SourceChain->getDefinition('Symfony\\Compone...')
#4 /Users/chris/.composer/vendor/couscous/couscous/bin/couscous(37): DI\Container->make('Symfony\\Compone...', Array)
#5 {main}
  thrown in /Users/chris/.composer/vendor/couscous/couscous/src/Module/Markdown/config.php on line 5

Fatal error: Uncaught Error: Call to undefined function DI\object() in /Users/chris/.composer/vendor/couscous/couscous/src/Module/Markdown/config.php:5
Stack trace:
#0 /Users/chris/.composer/vendor/php-di/php-di/src/Definition/Source/DefinitionFile.php(59): require()
#1 /Users/chris/.composer/vendor/php-di/php-di/src/Definition/Source/DefinitionFile.php(38): DI\Definition\Source\DefinitionFile->initialize()
#2 /Users/chris/.composer/vendor/php-di/php-di/src/Definition/Source/SourceChain.php(53): DI\Definition\Source\DefinitionFile->getDefinition('Symfony\\Compone...')
#3 /Users/chris/.composer/vendor/php-di/php-di/src/Container.php(164): DI\Definition\Source\SourceChain->getDefinition('Symfony\\Compone...')
#4 /Users/chris/.composer/vendor/couscous/couscous/bin/couscous(37): DI\Container->make('Symfony\\Compone...', Array)
#5 {main}
  thrown in /Users/chris/.composer/vendor/couscous/couscous/src/Module/Markdown/config.php on line 5
$

It looks like PHP-DI 5.4.4 was a broken release, so running composer global update did allow the couscous preview command to at least run.

Should the composer.json file version requirement be updated to 5.2.*, or should it be updated to ^5.4.5?

mnapoli commented 6 years ago

should it be updated to ^5.4.5?

Yes that would be great! (and thanks for digging into all that ^^)

alialghamdi commented 5 years ago

I'm facing the same issue, with php v7.2.13 and composer v1.9.1

This is my first try with couscous

PHP Fatal error:  Uncaught Error: Call to undefined function DI\object() in /Users/xxxxx/.composer/vendor/couscous/couscous/src/Module/Markdown/config.php:5
Stack trace:
#0 /Users/xxxxx/.composer/vendor/php-di/php-di/src/Definition/Source/DefinitionFile.php(59): require()
#1 /Users/xxxxx/.composer/vendor/php-di/php-di/src/Definition/Source/DefinitionFile.php(38): DI\Definition\Source\DefinitionFile->initialize()
#2 /Users/xxxxx/.composer/vendor/php-di/php-di/src/Definition/Source/SourceChain.php(53): DI\Definition\Source\DefinitionFile->getDefinition('Symfony\\Compone...')
#3 /Users/xxxxx/.composer/vendor/php-di/php-di/src/Container.php(164): DI\Definition\Source\SourceChain->getDefinition('Symfony\\Compone...')
#4 /Users/xxxxx/.composer/vendor/couscous/couscous/bin/couscous(37): DI\Container->make('Symfony\\Compone...', Array)
#5 {main}
  thrown in /Users/xxxxx/.composer/vendor/couscous/couscous/src/Module/Markdown/config.php on line 5

Fatal error: Uncaught Error: Call to undefined function DI\object() in /Users/xxxxx/.composer/vendor/couscous/couscous/src/Module/Markdown/config.php:5
Stack trace:
#0 /Users/xxxxx/.composer/vendor/php-di/php-di/src/Definition/Source/DefinitionFile.php(59): require()
#1 /Users/xxxxx/.composer/vendor/php-di/php-di/src/Definition/Source/DefinitionFile.php(38): DI\Definition\Source\DefinitionFile->initialize()
#2 /Users/xxxxx/.composer/vendor/php-di/php-di/src/Definition/Source/SourceChain.php(53): DI\Definition\Source\DefinitionFile->getDefinition('Symfony\\Compone...')
#3 /Users/xxxxx/.composer/vendor/php-di/php-di/src/Container.php(164): DI\Definition\Source\SourceChain->getDefinition('Symfony\\Compone...')
#4 /Users/xxxxx/.composer/vendor/couscous/couscous/bin/couscous(37): DI\Container->make('Symfony\\Compone...', Array)
#5 {main}
  thrown in /Users/xxxxx/.composer/vendor/couscous/couscous/src/Module/Markdown/config.php on line 5