Steph Fox wrote:
OK, so there are some things that should maybe 'just happen' here, and also when 'S' is used:

PHP_NAMED_FUNCTION(php_if_crc32)
{
char *p;
int len, nr;
php_uint32 crcinit = 0;
register php_uint32 crc;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &p, &nr) == FAILURE) {
 return;
}
...

Warning: crc32() expects parameter 1 to be strictly a binary string, Unicode string given in ...

Surely if a function's *expecting* a binary string it should do a silent conversion, and only throw a warning if the conversion fails? I don't see why the onus should always be on the user to adapt to this.

No, it shouldn't. Because crc32() and other HMACs depend on the actual bytes, there shouldn't be any automatic conversion. The user needs to pass in the binary string (bytes).

-Andrei

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to