RE: [PHP-DEV] bitwise operations and Unicode strings
| From: | Jared Williams | Date: | Wed, 30 May 2007 17:47:25 +0000 |
| Subject: | RE: [PHP-DEV] bitwise operations and Unicode strings | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-29959@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Antony Dovgal [mailto:antony@zend.com]
> Sent: 30 May 2007 09:21
> To: ceo@l-i-e.com
> Cc: php-dev
> Subject: Re: [PHP-DEV] bitwise operations and Unicode strings
>
> On 30.05.2007 04:15, Richard Lynch wrote:
> >> This code outputs "3" in native mode and "Fatal error: Unsupported
> >> operand types" in Unicode mode.
> >> I believe this is an inconsistency and it should be
> possible to use
> >> Unicode strings there.
> >
> > Given that there are probably a bazillion PHP scripts written by
> > newbies just like that, I'd have to say it's crucial for
> wide-spread
> > Unicode adoption for it to "just work"
>
> No, I'd say there might be like ten scripts on the planet
> relying on bitwise operations with strings, since numeric
> strings behaviour is different here.
I'd say more. Pear::Crypt_HMAC, for instance, does.
/* Calculate the padded keys and save them */
$this->_ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));
$this->_opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64));
Jared