Re: [PHP-DEV] [RFC] Base convert changes

This is only part of a thread. view whole thread
  105768
May 21, 2019 05:42 scott@exussum.co.uk (Scott Dutton)
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
  105771
May 21, 2019 08:43 george.banyard@gmail.com ("G. P. B.")
On Tue, 21 May 2019, 06:42 Scott Dutton, <scott@exussum.co.uk> wrote:

> > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php
Until the RFC is in voting you can still make amendments to it. So feel free to add these functions/examples to the RFC. Best regards George Peter Banyard