I think I found the real problem of WiFi issue on Htc One phones... If you played with Wi-Fi direct to connect with other phone then this is the case.
Go to WiFi, push the three dots upper right, click on Wi-Fi Direct, then check saved groups (bottom) if there are any groups delete them...