Hi Andrei,

I see where you're coming from over the (binary)|(string) issue, just trying to find some way that would preserve a little more back compatibility.

UG(ascii_conv) is for the format string, not the arguments. The warning is thrown by this code:

      convert_to_string_ex(argv[currentarg]);

It should check the arg type and return with a warning if it's Unicode.

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.

- Steph

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

Reply via email to