jrconlin/oauthsimple — pull request #21 by unknown8063 (2014-05-23 07:32:48+00:00)
Title: fixed bug where nonce was sometimes 1 character below min

Every once in a while my OAuth requests would fail with an authorization denied error. I eventually noticed that every failed request I sent had a 4 character nonce, which seems a bug since _getNonce() is given a length of 5 in the code.

When $rnum is exactly equal to the length of the string $_nonce_chars, the $result ends up being the empty string, which causes a shorter nonce than expected. The solution is to restrict the length to 0 and $cLength-1.