If the input data has an odd length a warning is thrown and false is returned.
. "Connection: close" instead of "Connection: closed" (Gustavo)
- Core:
+ . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov)
. Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables
(without apache2)). (Laruence)
. Fixed bug #61605 (header_remove() does not remove all headers). (Laruence)
return;
}
+ if (datalen % 2 != 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Hexadecimal input string must have an even length");
+ RETURN_FALSE;
+ }
+
result = php_hex2bin((unsigned char *)data, datalen, &newlen);
if (!result) {
--- /dev/null
+--TEST--
+Bug #61660: bin2hex(hex2bin($data)) != $data
+--FILE--
+<?php
+
+var_dump(hex2bin('123'));
+
+?>
+--EXPECTF--
+Warning: hex2bin(): Hexadecimal input string must have an even length in %s on line %d
+bool(false)