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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php