1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 08:28:26 +02:00

more fixed problems

This commit is contained in:
Antony Dovgal
2006-10-11 11:52:41 +00:00
parent 77bfbfc880
commit 08d9facf51
2 changed files with 46 additions and 6 deletions
+5 -6
View File
@@ -517,7 +517,6 @@ PHP_FUNCTION(mb_regex_encoding)
/* {{{ _php_mb_regex_ereg_exec */
static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
zval tmp;
zval **arg_pattern, *array;
char *string;
int string_len;
@@ -564,19 +563,18 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
match_len = 1;
str = string;
if (array != NULL) {
zval ret_array;
match_len = regs->end[0] - regs->beg[0];
array_init(&ret_array);
zval_dtor(array);
array_init(array);
for (i = 0; i < regs->num_regs; i++) {
beg = regs->beg[i];
end = regs->end[i];
if (beg >= 0 && beg < end && end <= string_len) {
add_index_stringl(&ret_array, i, (char *)&str[beg], end - beg, 1);
add_index_stringl(array, i, (char *)&str[beg], end - beg, 1);
} else {
add_index_bool(&ret_array, i, 0);
add_index_bool(array, i, 0);
}
}
REPLACE_ZVAL_VALUE(&array, &ret_array, 0);
}
if (match_len == 0) {
@@ -1098,6 +1096,7 @@ PHP_FUNCTION(mb_ereg_search_init)
WRONG_PARAM_COUNT;
break;
}
convert_to_string_ex(arg_str);
if (ZEND_NUM_ARGS() > 1) {
/* create regex pattern buffer */
convert_to_string_ex(arg_pattern);
+41
View File
@@ -0,0 +1,41 @@
--TEST--
mb_ereg() returning matches
--SKIPIF--
<?php if (!function_exists("mb_ereg")) print "skip"; ?>
--FILE--
<?php
$a = -1; $b = -1; $c = -1;
mbereg($a, $b, $c);
var_dump($a, $b, $c);
mberegi($a, $b, $c);
var_dump($a, $b, $c);
mbereg_search_init($a, $b, $c);
var_dump($a, $b, $c);
echo "Done\n";
?>
--EXPECTF--
int(-1)
int(-1)
array(1) {
[0]=>
string(2) "-1"
}
int(-1)
int(-1)
array(1) {
[0]=>
string(2) "-1"
}
Notice: Array to string conversion in %s on line %d
int(-1)
int(-1)
array(1) {
[0]=>
string(2) "-1"
}
Done