David Copperfield forced to reveal magic trick in court