summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index cb37176273..f6af763fd3 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2177,7 +2177,7 @@ PHP_FUNCTION(substr)
/* if "from" position is negative, count start position from the end
* of the string
*/
- if ((size_t)-f > ZSTR_LEN(str)) {
+ if (-(size_t)f > ZSTR_LEN(str)) {
f = 0;
} else {
f = (zend_long)ZSTR_LEN(str) + f;
@@ -2191,7 +2191,7 @@ PHP_FUNCTION(substr)
/* if "length" position is negative, set it to the length
* needed to stop that many chars from the end of the string
*/
- if ((size_t)(-l) > ZSTR_LEN(str) - (size_t)f) {
+ if (-(size_t)l > ZSTR_LEN(str) - (size_t)f) {
l = 0;
} else {
l = (zend_long)ZSTR_LEN(str) - f + l;