Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27972 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20554 invoked by uid 1010); 10 Feb 2007 00:43:15 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 20539 invoked from network); 10 Feb 2007 00:43:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2007 00:43:15 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:18243] helo=mx2.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/BD-03629-2251DC54 for ; Fri, 09 Feb 2007 19:43:14 -0500 Received: from [127.0.0.1] ([192.168.16.109]) by mx2.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 9 Feb 2007 16:43:11 -0800 Message-ID: <45CD151E.60900@zend.com> Date: Fri, 09 Feb 2007 16:43:10 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0b2 (Windows/20070116) MIME-Version: 1.0 To: internals@lists.php.net CC: 'Ilia Alshanetsky' References: <45CCC024.8070405@cubiclesoft.com> <45CD1271.1090704@zend.com> In-Reply-To: <45CD1271.1090704@zend.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 10 Feb 2007 00:43:11.0886 (UTC) FILETIME=[71186AE0:01C74CAC] Subject: weird code in php_char_to_str_ex From: stas@zend.com (Stanislav Malyshev) > 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/