Re: [RFC] Base convert changes
| From: | Scott Dutton | Date: | Tue, 21 May 2019 05:42:32 +0000 |
| Subject: | Re: [RFC] Base convert changes | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105768@lists.php.net to get a copy of this message | ||
Not sure if I can add and example to the RFC at this point, but I came across another example of this recently.
https://gist.github.com/iansltx/4820b02ab276c3306314daaa41573445#file-getlines-php-L9
// bindec() was doing weird things, hence converting through hex first
// sttrev() to match endian-ness to expectations; zip file values are little-endian
$compressedSize = hexdec(bin2hex(strrev(fread($stream, 4)))); // compressed size
bindec was returning 0 without warning, as it was passed binary data not a binary string. No warning bin2hex actually does the correct translation.
a warning here would have at least indicated there was something wrong with the input it was being passed instead of just 0.
Thanks
Scott