silverstripe/sapphire — pull request #416 by hdrlab (2012-05-09 03:22:20+00:00)
Title: 2.4

A fix to prevent allowedActions() from failing with a warning when the main class doesn't have an allowed_actions array, but one or more of its extensions does.

Background:
I created a DataObjectDecorator for a form object that added an action. However, it refused to execute the action, giving an "action not allowed" error. Adding an allowed_actions array to the decorator was the only option, but caused RequestHandler::allowedActions() to fail with the following error: "Argument #1 is not an array". This small patch eliminates the error.

NOTES:
- The reason why the new code is where it is, is so that the function still returns nothing (not even an empty array) if no actions are found
- The master branch appears to also have the same defect, so it's worth checking that too, and fixing it if necessaryBackground:
I created a DataObjectDecorator for a form object that added an action. However, it refused to execute the action, giving an "action not allowed" error. Adding an allowed_actions array to the decorator was the only option, but caused RequestHandler::allowedActions() to fail with the following error: "Argument #1 is not an array". This small patch eliminates the error.

NOTES:
- The reason why the new code is where it is, is so that the function still returns nothing (not even an empty array) if no actions are found
- The master branch appears to also have the same defect, so it's worth checking that too, and fixing it if necessary