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

Fix _checkMethods() for abstract controllers #41

Closed
wants to merge 2 commits into from

Conversation

sarrala
Copy link
Contributor

@sarrala sarrala commented Jan 29, 2015

Issue: AclExtras::_checkMethods() Exception if it faces abstract controller #40

Issue: AclExtras::_checkMethods() Exception if it faces abstract controller cakephp#40
$reflectionClass = new \ReflectionClass( $namespace );
$actions = null;
if ($reflectionClass->IsInstantiable()) {
$actions = get_class_methods(new $namespace);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a bad idea given that the class may have required constructor parameters. It might be better to use the reflection instance to get the methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would fail only if constructor throws something at you, this is probably what you meant by required parameters. I think that missing parameters will only generate warnings.

You are right that ReflectionClass is way to go, and we already have it in this soup.

I'll fix it.

Using reflection we don't need to worry about code inside controller constructors.
\ReflectionMethod::IS_PUBLIC filter added as only public methods will be accessible as controller actions.
@markstory
Copy link
Member

Looks like there are some conflicts that need to be resolved before this can be merged.

@rchavik rchavik self-assigned this Jun 2, 2015
@rchavik
Copy link
Member

rchavik commented Jun 2, 2015

Rebased and merged in 8447388

Thanks @sarrala

@rchavik rchavik closed this Jun 2, 2015
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

Successfully merging this pull request may close these issues.

None yet

3 participants