Fix regression for cake 2.x

See: cakephp/cakephp#3758