Adding a fix for #5463
Added test provided by original reporter of #5463
Merge pull request #5476 from cakephp/3.0-matching-fixes

3.0 matching fixes