summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>1999-05-12 12:53:45 +0000
committerRasmus Lerdorf <rasmus@php.net>1999-05-12 12:53:45 +0000
commitfbeeb8f29c09c9c434f82a845ed11806da024852 (patch)
treed07a9ff06ca479fa28ba573d294bf8c0b295a22b
parent43d93b653364415ca5d7f436e7e8a04753152f4d (diff)
downloadphp-git-fbeeb8f29c09c9c434f82a845ed11806da024852.tar.gz
substr() fix
-rw-r--r--ext/standard/string.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 012de6a611..e1880c93b6 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -826,9 +826,10 @@ void php3_substr(INTERNAL_FUNCTION_PARAMETERS)
RETURN_FALSE;
}
- if ((f + l) < (int)string->value.str.len) {
- string->value.str.val[f + l] = '\0';
+ if((f+l) > (int)string->value.str.len) {
+ l = (int)string->value.str.len - f;
}
+
RETVAL_STRINGL(string->value.str.val + f, l, 1);
}
/* }}} */