Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54229 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93142 invoked from network); 28 Jul 2011 11:00:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2011 11:00:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:46550] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/C7-50004-E21413E4 for ; Thu, 28 Jul 2011 07:00:00 -0400 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id B5A40DED9F; Thu, 28 Jul 2011 11:59:55 +0100 (BST) Date: Thu, 28 Jul 2011 11:59:55 +0100 (BST) X-X-Sender: derick@whisky To: Laruence cc: PHP Internals In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] [RFC]strn(case)cmp supporting negative length as third parameter From: derick@php.net (Derick Rethans) On Thu, 28 Jul 2011, Laruence wrote: > Hi: > > strn(case)cmp dosen't support a negative length as its third > paramter, while substr dose. > > I wrote a patch to make strn(case)cmp supporting negative length, > make following script works as expect: > > if (strncmp("prefix_num", "num", -3) === 0) { > echo "they have same suffix\n"; > } > ?> > > here is the rfc: https://wiki.php.net/rfc/strncmpnegativelen - You're changing binary API of some API functions, so this can't go into PHP 5.3: -ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, uint length); +ZEND_API int zend_binary_strncmp(const char *s1, uint len1, const char *s2, uint len2, int length); cheers, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug