this method [ isBase64 ] is showing incorrect results. In below image.
Thanks for reaching raising the issue @KInGATiLLa.
I will do more investigation on the issue here.
Also, other people can do more investigation here.
Why should "1111" not be considered a valid base64 value? Looking at the implementation and the rfc 4648 I can't see why it should be the case.
@profnandaa @ezkemboi i tried to reproduce the issue and that is correct. The string "1111" actually passes the validation which is bizzare. I can do a PR on this shortly if you like
@rubiin -- sure, please do.
@profnandaa The string "1111" is a valid base64 and actually resolves to a string.
The string "" is valid base64 (see first example https://tools.ietf.org/html/rfc4648#section-10) but isBase64("") returns false.
Edit: moved this to a new issue for more visibility as it is clearly a bug.
I agree with @parasg1999. According to section 4 of RFC 4648 (at the bottom of page 5) the following case applies which implies, that 1111 is valid base64 (with each 1 representing 6 bits of the encoded data resulting in 24bits = 3 bytes of data):
(1) The final quantum of encoding input is an integral multiple of 24
bits; here, the final unit of encoded output will be an integral
multiple of 4 characters with no "=" padding.
I suggest closing this issue.
Most helpful comment
@profnandaa The string "1111" is a valid base64 and actually resolves to a string.