Skip to content

Conversation

@srgoogleguy
Copy link
Contributor

This bug fix now introduces a second optional argument to hex2bin that will comply with BC.
Additionally, the patch prevents an empty string from being accepted (as the existing patch did not).

This bug fix now introduces a second optional argument to hex2bin that will comply with BC
@srgoogleguy
Copy link
Contributor Author

As per our conversation on IRC:

"Just to clarify beforehand, as there is some confusion about this:
hex2bin does not convert a hex number to a binary number. hex2bin converts a hexadecimally encoded binary string into a non-encoded binary string. To emphasize again: hex2bin has (nearly) nothing to do with numbers. It's a way to encode strings (or better to say binary strings, but in PHP all strings are binary). And as every byte of data is encoded using two hexadecimal characters (16 * 16 = 256) the encoded string can't be of odd length. Two hex digits always form a pair."

It's clear that many people agree the documentation on hex2bin is quite confusing in this matter. A note has been made to fix this in the doc. Closing PR...thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant