Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54596 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33847 invoked from network); 14 Aug 2011 21:03:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2011 21:03:06 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.123 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.123 smtp123.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.123] ([67.192.241.123:42755] helo=smtp123.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/94-05730-908384E4 for ; Sun, 14 Aug 2011 17:03:06 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 388B978172; Sun, 14 Aug 2011 17:03:02 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp2.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id BF6CC78249; Sun, 14 Aug 2011 17:03:01 -0400 (EDT) Message-ID: <4E483804.7070009@sugarcrm.com> Date: Sun, 14 Aug 2011 14:03:00 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Rasmus Lerdorf CC: Derick Rethans , PHP Internals References: <4E48121A.3090007@sugarcrm.com> <4E48134E.4030708@sugarcrm.com> <4E481695.6040900@php.net> In-Reply-To: <4E481695.6040900@php.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [VOTE]strn(case)cmp supporting a negative length as its third paramter From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! On 8/14/11 11:40 AM, Rasmus Lerdorf wrote: > My main issue with changing strncmp/strncasecmp is that these are > currently exact mappings of the underlying libc functions. For people And why should anybody care? 99% of people using PHP never used a libc function and can hardly tell libc from gcc. If we can extend this function with useful functionality, nobody cares about what libc does. > For example, I could imagine people writing code along these lines: > > $len = strlen($user_data) - strlen($suffix); > if(!strncmp($user_data, $string, $len)) { > // do something > } Warning doesn't fix the bug - and unless you're in 0.0001% of the population that actually reads the logs daily and checks every message there it would be little to help you. We should have more useful functions, not more warnings. Warning won't make this code to work. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227