You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which operating systems have you tested for this bug?
macOS
Which server did you use?
fpm-fcgi
Database
No response
What happened?
I am creating a composer package to be used in future CI4 projects (and to make opensource once all the features have been developed).
The CodeIgniter\Router\RouteCollection class has a method called discoverRoutes which looks for files named Config/Routes.php in your CI4 project (both in the App directory and in vendor).
The CodeIgniter\Filters\Filters class has a very similar method called discoverFilters which does the same thing but with files named Config/Filters.php, on line 187 it checks if the name of the class it has found is FiltersConfig::class, this way it does not include the Filters class from the App directory again.
// The $file may not be a class file.$className = $locator->getClassname($file);
// Don't include our main Filter config again...if ($className === FiltersConfig::class || $className === BaseFiltersConfig::class) {
continue;
}
With this approach it is not initializing the Filters class from my package, they have the same class name but different namespaces, I think it would be better to check if the class has the same class name and namespace as the FiltersConfig class.
Steps to Reproduce
Create a directory in vendor
Create your composer.json file, this is an example:
PHP Version
8.3
CodeIgniter4 Version
4.6.0
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
macOS
Which server did you use?
fpm-fcgi
Database
No response
What happened?
I am creating a composer package to be used in future CI4 projects (and to make opensource once all the features have been developed).
The
CodeIgniter\Router\RouteCollection
class has a method calleddiscoverRoutes
which looks for files namedConfig/Routes.php
in your CI4 project (both in the App directory and in vendor).The
CodeIgniter\Filters\Filters
class has a very similar method calleddiscoverFilters
which does the same thing but with files namedConfig/Filters.php
, on line 187 it checks if the name of the class it has found is FiltersConfig::class, this way it does not include the Filters class from the App directory again.With this approach it is not initializing the Filters class from my package, they have the same class name but different namespaces, I think it would be better to check if the class has the same class name and namespace as the FiltersConfig class.
Steps to Reproduce
Config/Filters.php
discoverFilters
discoverFilters
I found a workaround using the config function:
Expected Output
.
Anything else?
No response
The text was updated successfully, but these errors were encountered: