[ticket/11444] Throw an exception when the method isn't valid

PHPBB3-11444