Re: Unicode progress [Was: unicode.semantics ad infinitum]

From: Date: Tue, 27 May 2008 17:32:25 +0000
Subject: Re: Unicode progress [Was: unicode.semantics ad infinitum]
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-37919@lists.php.net to get a copy of this message
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

« previous php.internals (#37919) next »