|
|
|
@ -4446,6 +4446,10 @@ PHP_FUNCTION(substr_count) |
|
|
|
|
|
|
|
if (ac > 2) { |
|
|
|
convert_to_long_ex(offset); |
|
|
|
if (Z_LVAL_PP(offset) < 0) { |
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset should be greater then or equal to 0."); |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
p += Z_LVAL_PP(offset); |
|
|
|
if (p > endp) { |
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset value %ld exceeds string length.", Z_LVAL_PP(offset)); |
|
|
|
@ -4453,6 +4457,10 @@ PHP_FUNCTION(substr_count) |
|
|
|
} |
|
|
|
if (ac == 4) { |
|
|
|
convert_to_long_ex(length); |
|
|
|
if (Z_LVAL_PP(length) <= 0) { |
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length should be greater than 0."); |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
if ((p + Z_LVAL_PP(length)) > endp) { |
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value %ld exceeds string length.", Z_LVAL_PP(length)); |
|
|
|
RETURN_FALSE; |
|
|
|
|