Had the same problem, noticed the fix was giving back messed up code, looked around a little and found this solution instead: https://www.hightechdad.com/2011/05/18/how-to-pre-populate-twitter-status-updates-the-new-way-via-links-web-intents/
so change the share_url line to:
‘share_url’ => “https://twitter.com/intent/tweet?text=TITLEURI”,
and you get a nice pop out window with your post! Thanks for your help finding what I needed to change, hopefully this helps you!