validate context passed from php