Update legacy.php

See #5008