Solution...?
The password recordset was returning HTML special characters. The following addition fixed it...
$stored_password= html_entity_decode($stored_password, ENT_QUOTES | ENT_HTML5, 'UTF-8');
Looks to be working fine now. Posting this to help others in the future, and possibly myself when I forget this workaround!