diff options
author | Moriyoshi Koizumi <moriyoshi@php.net> | 2002-10-06 06:37:47 +0000 |
---|---|---|
committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2002-10-06 06:37:47 +0000 |
commit | 0601d1fc41b1e3bdf3b6e4d98573ce6df0df6422 (patch) | |
tree | 81fd25a2c7b38a6015ab2437d212fd2dbd198ac8 /ext/mbstring/php_mbregex.c | |
parent | 8684c06b6d021570141066d978869d6c30edcdc7 (diff) | |
download | php-git-0601d1fc41b1e3bdf3b6e4d98573ce6df0df6422.tar.gz |
made messages more consistent
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r-- | ext/mbstring/php_mbregex.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 052d414ae0..9a5b3a1a52 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -229,7 +229,7 @@ PHP_FUNCTION(mb_regex_encoding) convert_to_string_ex(arg1); mbctype = php_mbregex_name2mbctype(Z_STRVAL_PP(arg1)); if (mbctype < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg1)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", Z_STRVAL_PP(arg1)); RETVAL_FALSE; } else { MBSTRG(current_mbctype) = mbctype; @@ -726,11 +726,11 @@ php_mbereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode) } if (!MBSTRG(search_re)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no regex for search"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No regex given"); RETURN_FALSE; } if (!str) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "no string for search"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No string given"); RETURN_FALSE; } if (MBSTRG(search_regs)) { @@ -962,8 +962,11 @@ PHP_FUNCTION(mb_ereg_search_setpos) } convert_to_long_ex(arg_pos); n = Z_LVAL_PP(arg_pos); - if (n < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "position is minus value"); + if (n < 0 + || ( MBSTRG(search_str) != NULL && *MBSTRG(search_str) != NULL && + Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING && + n >= Z_STRLEN_PP(MBSTRG(search_str)) ) ) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Position is out of range"); MBSTRG(search_pos) = 0; RETVAL_FALSE; } else { |