]> granicus.if.org Git - php/commitdiff
Re-added check removed by the previous patch
authorIlia Alshanetsky <iliaa@php.net>
Sat, 10 Mar 2007 20:07:50 +0000 (20:07 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 10 Mar 2007 20:07:50 +0000 (20:07 +0000)
ext/standard/string.c

index 7f7eb85d7fef7c7b1537f459c2d6c695d5de1f69..7e32ba33f53059d5f6eb28b0d9d003d8ce76ccad 100644 (file)
@@ -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);