tony2001 Wed Oct 11 11:53:02 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/mbstring/tests mb_ereg2.phpt
Modified files:
/php-src/ext/mbstring php_mbregex.c
Log:
MFH
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/php_mbregex.c?r1=1.53.2.1.2.1&r2=1.53.2.1.2.2&diff_format=u
Index: php-src/ext/mbstring/php_mbregex.c
diff -u php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.1
php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.2
--- php-src/ext/mbstring/php_mbregex.c:1.53.2.1.2.1 Wed Oct 11 11:09:42 2006
+++ php-src/ext/mbstring/php_mbregex.c Wed Oct 11 11:53:02 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mbregex.c,v 1.53.2.1.2.1 2006/10/11 11:09:42 tony2001 Exp $ */
+/* $Id: php_mbregex.c,v 1.53.2.1.2.2 2006/10/11 11:53:02 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
@@ -517,7 +517,6 @@
/* {{{ _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 @@
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 @@
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);
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_ereg2.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_ereg2.phpt
+++ php-src/ext/mbstring/tests/mb_ereg2.phpt
--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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php