cvs: php4 /ext/mbstring php_mbregex.c
| From: | Moriyoshi Koizumi | Date: | Sun, 06 Oct 2002 06:37:48 +0000 |
| Subject: | cvs: php4 /ext/mbstring php_mbregex.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-14589@lists.php.net to get a copy of this message | ||
moriyoshi Sun Oct 6 02:37:48 2002 EDT
Modified files:
/php4/ext/mbstring php_mbregex.c
Log:
made messages more consistent
Index: php4/ext/mbstring/php_mbregex.c
diff -u php4/ext/mbstring/php_mbregex.c:1.6 php4/ext/mbstring/php_mbregex.c:1.7
--- php4/ext/mbstring/php_mbregex.c:1.6 Sun Oct 6 02:21:34 2002
+++ php4/ext/mbstring/php_mbregex.c Sun Oct 6 02:37:47 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mbregex.c,v 1.6 2002/10/06 06:21:34 moriyoshi Exp $ */
+/* $Id: php_mbregex.c,v 1.7 2002/10/06 06:37:47 moriyoshi Exp $ */
#ifdef HAVE_CONFIG_H
@@ -229,7 +229,7 @@
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 @@
}
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 @@
}
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 {