tmp = (char *)p + length;
}
if (tmp > endp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value %ld exceeds string length", offset);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value %ld exceeds string length", length);
RETURN_FALSE;
} else {
endp = tmp;
offset = (offset < 0) ? 0 : offset;
}
- if ((offset + len) > s1_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The specified segment exceeds string length");
+ if(offset > s1_len) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The start position cannot exceed initial string length");
+ RETURN_FALSE;
+ }
+
+ if(len > s1_len - offset) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length cannot exceed initial string length");
RETURN_FALSE;
}
bool(false)
bool(false)
-Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s on line %d
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d
bool(false)
Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
bool(false)
-Warning: stripos(): Offset not contained in string. in %s on line %d
+Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s on line %d
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d
bool(false)
-Warning: substr_count(): Length value 2147483647 exceeds string length. in %s on line %d
+Warning: substr_count(): Length value 2147483647 exceeds string length in %s on line %d
bool(false)
-Warning: strpos(): Offset not contained in string. in %s on line %d
+Warning: strpos(): Offset not contained in string in %s on line %d
bool(false)
-Warning: stripos(): Offset not contained in string. in %s on line %d
+Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
int(2)
string(8) "abcdeabc"
bool(false)
+--UEXPECTF--
+unicode(4) "bcde"
+bool(false)
+bool(false)
+bool(false)
+
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d
+bool(false)
+
+Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+
+Warning: substr_count(): Offset value 2147483647 exceeds string length in %s on line %d
+bool(false)
+
+Warning: substr_count(): Length value 2147483647 exceeds string length in %s on line %d
+bool(false)
+
+Warning: strpos(): Offset not contained in string in %s on line %d
+bool(false)
+
+Warning: stripos(): Offset not contained in string in %s on line %d
+bool(false)
+
+Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+
+Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d
+bool(false)
+int(2)
+unicode(8) "abcdeabc"
+bool(false)