Patch to prevent modification of the array passed in to polymorphic_path

Hi all,

Can I get a review or two regarding this patch? Fixes some nasty unexpected behaviour in polymorphic_path whereby the array fed to the method is actually modified in-place, potentially causing confusion for client code. See the ticket for more details.