A warning is thrown if the input string is of odd length.

This behaviour is new in PHP 5.4.1.

http://php.net/manual/en/function.hex2bin.php
This is hard to read because 1 and L are so close together. You should change the name to str_len or something more obvious.