If you're stopped by a police officer and are suspected of committing some crime then yes you must give your details to the police.
But if you're not being suspected of any crimes and you're not driving then no you do not have to give details to the police.
Never give up information to the police unless you're required too and if they threaten you with arrest just because you refuse to ID yourself and you haven't committed any crimes request the police supervisor and speak with the supervisor.
Never just take a police officers words for it as they may not be following the law correctly.