From: Ilia Alshanetsky Date: Sat, 10 Mar 2007 20:07:50 +0000 (+0000) Subject: Re-added check removed by the previous patch X-Git-Tag: php-5.2.2RC1~174 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e82c30c845fdc74eed6873b4f7b7fd2bfb0b302a;p=php Re-added check removed by the previous patch --- diff --git a/ext/standard/string.c b/ext/standard/string.c index 7f7eb85d7f..7e32ba33f5 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2065,6 +2065,8 @@ PHP_FUNCTION(substr) l = Z_LVAL_PP(len); if ((l < 0 && -l > Z_STRLEN_PP(str))) { RETURN_FALSE; + } else if (l > Z_STRLEN_PP(str)) { + l = Z_STRLEN_PP(str); } } else { l = Z_STRLEN_PP(str);