phalcon / phalcon-devtools

Phalcon Developer Tools
https://docs.phalcon.io/latest/en/devtools
Other
1.33k stars 630 forks source link

PHP Fatal Error - Creating controller #1435

Closed brunomerod closed 3 years ago

brunomerod commented 4 years ago

Trying to create a controller from phalcon-devtools command line. It's working on every project except this one...

Command

phalcon controller test

Expected Behavior

Phalcon DevTools (4.0.1)

Success: Controller "test" was successfully created.  

Info: /var/www/PATH/app/controllers/TestController.php  

Actual Behavior (Fatal Error Output)

Phalcon DevTools (4.0.1)

PHP Fatal error:  Uncaught TypeError: Return value of Phalcon\DevTools\Builder\Path::getConfig() must be an instance of Phalcon\Config, integer returned in /home/bruno/phalcon-devtools/src/Builder/Path.php:69
Stack trace:
#0 /home/bruno/phalcon-devtools/src/Builder/Component/AbstractComponent.php(86): Phalcon\DevTools\Builder\Path->getConfig('ini')
#1 /home/bruno/phalcon-devtools/src/Builder/Component/Controller.php(57): Phalcon\DevTools\Builder\Component\AbstractComponent->getConfig()
#2 /home/bruno/phalcon-devtools/src/Commands/Builtin/Controller.php(63): Phalcon\DevTools\Builder\Component\Controller->build()
#3 /home/bruno/phalcon-devtools/src/Script.php(109): Phalcon\DevTools\Commands\Builtin\Controller->run(Array)
#4 /home/bruno/phalcon-devtools/src/Script.php(148): Phalcon\DevTools\Script->dispatch(Object(Phalcon\DevTools\Commands\Builtin\Controller))
#5 /home/bruno/phalcon-devtools/phalcon(64): Phalcon\DevTools\Script->run()
#6 {main}
  thrown in /home/bruno/phalcon-devtools/src/Builder/Path.php on line 69

Details

Jeckerson commented 4 years ago

What is your config file?

brunomerod commented 4 years ago

It's the default one. Jus recently created this project with 'phalcon project PROJECT_NAME'.

`<?php

defined('BASE_PATH') || define('BASE_PATH', getenv('BASE_PATH') ?: realpath(dirname(FILE) . '/../..')); defined('APP_PATH') || define('APP_PATH', BASE_PATH . '/app');

/*

BeMySlaveDarlin commented 3 years ago

This error appears in cases, when you have config.php and config.ini at the same time in you configs folder or when other conflicting changes we done after default installation to files structure. Driving through trace can detect Phalcon\DevTools\Builder\Path->getConfig('ini') call at last stack, where 'ini' should be NULL by $type = null methods signature, if no option were provided by input. Is not reproducible normal ways.