return false instead of empty string when -length is greater than (len - offset)

This commit is contained in:
Antony Dovgal 2007-03-12 23:42:26 +00:00
parent c829314963
commit 81f99c721b

View File

@ -2077,6 +2077,10 @@ PHP_FUNCTION(substr)
RETURN_FALSE;
}
if (l < 0 && (l + Z_STRLEN_PP(str) - f) < 0) {
RETURN_FALSE;
}
/* if "from" position is negative, count start position from the end
* of the string
*/