magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Fatal error when calling execute()

Open kschroeder opened this issue 12 years ago • 5 comments

This is more of a question than a bug, but when creating controllers without an execute() method defined for Magento\Framework\App\Action\Action there is a fatal error if that method is not defined. The dispatch() method calls the execute() method on itself. That's not really all that surprising. But I was wondering what the use case is that we don't define the method execute() as abstract, since it's technically a requirement if the dispatch() method is called. It may be a minor thing but I would rather get a compiler or IDE error instead of a runtime error, especially when the dependency on that method is known. Perhaps it relates to mocking action classes, I don't know, but I was wondering why that method is called without being declared as abstract.

kschroeder avatar Nov 25 '14 16:11 kschroeder

It's a mistake. We'll fix this. Thanks for bringing this up.

antonkril avatar Nov 25 '14 17:11 antonkril

Hi @kschroeder, let us know if the issue was fixed.

maksek avatar Jan 08 '15 22:01 maksek

I'm looking over the m2 code on Github and I don't see the method execute() defined in the action interface, the abstract action class nor the action class. This would still seem to cause the behavior noted in the issue.

kschroeder avatar Jan 09 '15 14:01 kschroeder

Internal ticket: MAGETWO-31249

monkeysee avatar Jan 23 '15 20:01 monkeysee

This issue is fixed with pull request #1416

joanhe avatar Oct 06 '15 17:10 joanhe