Re: [RFC]strn(case)cmp supporting negative length as third parameter
| From: | Laruence | Date: | Thu, 28 Jul 2011 12:25:07 +0000 |
| Subject: | Re: [RFC]strn(case)cmp supporting negative length as third parameter | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54232@lists.php.net to get a copy of this message | ||
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-supproting-negative-len.patch
thanks
2011/7/28 Pierre Joye <pierre.php@gmail.com>:
> 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 <laruence@php.net> wrote:
>> Hi:
>>
>> why?
>>
>> I think this change would not cause any other side-effects.
>>
>> and if you are worry about INT_MAX, I think it's ok to declare with
>> long(in fact, I already did so).
>>
>> thanks
>>
>> 2011/7/28 Derick Rethans <derick@php.net>:
>>> 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:
>>>>
>>>> <?php
>>>> 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
>>>
>>
>>
>>
>> --
>> Laruence Xinchen 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
>
--
Laruence Xinchen Hui
http://www.laruence.com/