Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54232 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15798 invoked from network); 28 Jul 2011 12:25:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2011 12:25:12 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.46 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.46 mail-vw0-f46.google.com Received: from [209.85.212.46] ([209.85.212.46:59969] helo=mail-vw0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/3C-50004-525513E4 for ; Thu, 28 Jul 2011 08:25:10 -0400 Received: by vws1 with SMTP id 1so1985435vws.19 for ; Thu, 28 Jul 2011 05:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=IVZgN1XNdJDwujFgoDjMiBafk5QeEiEZlr04dnZLVHo=; b=qT76HRnn9iACmlGgXSA0rAmC5B7oTBVFNxYURv4+ebGpqphy84iydNDpzw8MzoE7K0 7V31ESHMuyOCDr4Oq2eKb51Cjkv/1d7rnpXKp3a6dPYw0s7u4MpDv7Yp1RmR3cXHrtFQ OeiB2QjCyDJVaYq0yL+ef5Mu2bMCvvS3NIuec= MIME-Version: 1.0 Received: by 10.220.71.133 with SMTP id h5mr267403vcj.200.1311855907115; Thu, 28 Jul 2011 05:25:07 -0700 (PDT) Sender: laruence@gmail.com Received: by 10.220.161.130 with HTTP; Thu, 28 Jul 2011 05:25:07 -0700 (PDT) In-Reply-To: References: Date: Thu, 28 Jul 2011 20:25:07 +0800 X-Google-Sender-Auth: 7SN3WXecgGA0_NM2mPL2UPtXC1s Message-ID: To: PHP Internals Cc: Derick Rethans , Pierre Joye Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC]strn(case)cmp supporting negative length as third parameter From: laruence@php.net (Laruence) Hi: As Derick and Pierre said(in IRC), I change the patch base from PHP 5.3 to PHP5.4, and avoid changing ZEND_API declaration. RFC updated new patch : http://www.laruence.com/php-dev/php-5.4-trunk-strncmp-supprot= ing-negative-len.patch thanks 2011/7/28 Pierre Joye : > the signature is not the same anymore, some extension may not build > anymore (depending on the compiler used and its flag). > > Cheers, > > On Thu, Jul 28, 2011 at 1:32 PM, Laruence wrote: >> Hi: >> >> why? >> >> I think this change would not cause any other side-effects. >> >> and if you are worry about INT_MAX, =C2=A0I think it's ok to declare wit= h >> long(in fact, I already did so). >> >> thanks >> >> 2011/7/28 Derick Rethans : >>> On Thu, 28 Jul 2011, Laruence wrote: >>> >>>> Hi: >>>> >>>> =C2=A0 strn(case)cmp dosen't =C2=A0support a negative length as its th= ird >>>> paramter, =C2=A0while substr dose. >>>> >>>> =C2=A0I wrote a patch to make strn(case)cmp supporting negative length= , >>>> make following script works as expect: >>>> >>>> =C2=A0 =C2=A0 >>> =C2=A0 =C2=A0if (strncmp("prefix_num", "num", -3) =3D=3D=3D 0) { >>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "they have same suffix\n"; >>>> =C2=A0 =C2=A0} >>>> =C2=A0 ?> >>>> >>>> =C2=A0here is the rfc: https://wiki.php.net/rfc/strncmpnegativelen >>> >>> - You're changing binary API of some API functions, so this can't go >>> =C2=A0into PHP 5.3: >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0-ZEND_API int zend_binary_strncmp(const char= *s1, uint len1, const char *s2, uint len2, uint length); >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0+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 >>> >> >> >> >> -- >> Laruence =C2=A0Xinchen Hui >> http://www.laruence.com/ >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/