Skip to content

Wrong ROOTPATH on console #460

Description

@eddmash

The ROOTPATH on console is wrong which has the effect composer autoloader is never required.

If i create a command at application/Commands/Powerorm.php

namespace App\Commands;

use CodeIgniter\CLI\BaseCommand; 

class Powerorm extends BaseCommand
{
    protected $group = 'Powerorm';
    protected $name  = 'powerorm';
    protected $description = 'Displays powerorm commands.';


    public function run(array $params)
    {
        var_dump(realpath(ROOTPATH));
    }
}

The output i get is /opt/lampp/htdocs/ci4/public where instead of /opt/lampp/htdocs/ci4 which is what i get when i run

var_dump(realpath(ROOTPATH));

On the view.

This also has the side effect of, i am not able to use packages on the vendor folder in my command. since composer autloader is never required on the system/bootstrap.php

e.g. if i try the dump() method found on symfony/var-dumper which is already on my vendor.

Type:        Error
Message:     Call to undefined function App\Commands\dump()
Filename:    /opt/lampp/htdocs/ci4/application/Commands/Powerorm.php
Line Number: 27

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions