Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to isActionMapped during Controller.initialize event crashes controller bake #688

Open
asgraf opened this issue Feb 2, 2023 · 1 comment

Comments

@asgraf
Copy link

asgraf commented Feb 2, 2023

How to reproduce:

  1. For example add following line at the end of your AppController::initialize()
debug($this->Crud->isActionMapped());
  1. Bake any controller (confirm that you want to override controller if already exists)
  2. Crash during bake:
[TypeError] Cake\Utility\Inflector::variable(): Argument #1 ($string) must be of type string, null given, called in /application/vendor/friendsofcake/crud/src/Controller/Component/CrudComponent.php on line 430 in /application/vendor/cakephp/cakephp/src/Utility/Inflector.php on line 511
@ADmad
Copy link
Member

ADmad commented Feb 2, 2023

The default crud action is set in CrudComponent::initialize() which gets run after Controller::initialize(). While we could fix the exception calling isActionMapped() so early without an argument will never yield the correct result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants