cvs: php-src /ext/standard string.c
| From: | Ilia Alshanetsky | Date: | Mon, 26 Sep 2005 23:08:11 +0000 |
| Subject: | cvs: php-src /ext/standard string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-34152@lists.php.net to get a copy of this message | ||
iliaa Mon Sep 26 19:08:11 2005 EDT
Modified files:
/php-src/ext/standard string.c
Log:
Allow substr_compare() to take a negative offset to facilitate start of the
comparison from the end of string.
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.482&r2=1.483&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.482 php-src/ext/standard/string.c:1.483
--- php-src/ext/standard/string.c:1.482 Fri Sep 9 15:07:18 2005
+++ php-src/ext/standard/string.c Mon Sep 26 19:08:10 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.482 2005/09/09 19:07:18 rolland Exp $ */
+/* $Id: string.c,v 1.483 2005/09/26 23:08:10 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -5770,6 +5770,10 @@
RETURN_FALSE;
}
+ if (offset < 0) { /* negative offset, start comparison at the end of string */
+ offset = s1_len + offset;
+ }
+
if (len && offset >= s1_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string
length.");
RETURN_FALSE;