weird code in php_char_to_str_ex

From: Date: Sat, 10 Feb 2007 00:43:10 +0000
Subject: weird code in php_char_to_str_ex
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-27972@lists.php.net to get a copy of this message
I can reproduce it. Seems to be off-by-one here: Z_STRVAL_P(result) = target = safe_emalloc(char_count, to_len, len); introduced by this patch: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.36&r2=1.445.2.14.2.37 If I replace len with len+1, it seems to be OK.
Looking more on this code of php_char_to_str_ex, it seems very strange to me, especially this part: if (char_count == 0 && case_sensitivity) { ZVAL_STRINGL(result, str, len, 1); return 0; } Why check case_sensitivity here? Looks like some code remained un-cleaned from previous versions. Any arguments against removing this check? -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

« previous php.internals (#27972) next »