This commit is contained in:
Xinchen Hui 2015-02-13 14:29:27 +08:00
commit 3224459232
2 changed files with 18 additions and 17 deletions

View File

@ -148,30 +148,20 @@ U_CFUNC PHP_FUNCTION(breakiter_get_text)
U_CFUNC PHP_FUNCTION(breakiter_set_text)
{
char *text;
size_t text_len;
UText *ut = NULL;
zval *textzv;
zend_string *text;
BREAKITER_METHOD_INIT_VARS;
object = getThis();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&text, &text_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_set_text: bad arguments", 0);
RETURN_FALSE;
}
int res = zend_get_parameters_ex(1, &textzv);
assert(res == SUCCESS);
BREAKITER_METHOD_FETCH_OBJECT;
/* assert it's safe to use text and text_len because zpp changes the
* arguments in the stack */
assert(text == Z_STRVAL_P(textzv));
ut = utext_openUTF8(ut, text, text_len, BREAKITER_ERROR_CODE_P(bio));
ut = utext_openUTF8(ut, text->val, text->len, BREAKITER_ERROR_CODE_P(bio));
INTL_CTOR_CHECK_STATUS(bio, "breakiter_set_text: error opening UText");
bio->biter->setText(ut, BREAKITER_ERROR_CODE(bio));
@ -183,7 +173,7 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text)
* keep the string buffer around by holding a reference to its zval. This
* also allows a faste implementation of getText() */
zval_ptr_dtor(&bio->text);
ZVAL_COPY(&bio->text, textzv);
ZVAL_STR_COPY(&bio->text, text);
RETURN_TRUE;
}
@ -272,7 +262,7 @@ U_CFUNC PHP_FUNCTION(breakiter_next)
no_arg_version = true;
} else if (ZEND_NUM_ARGS() == 1) {
zval *arg;
int res = zend_get_parameters_ex(1, &arg);
int res = zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg);
assert(res == SUCCESS);
if (Z_TYPE_P(arg) == IS_NULL) {
no_arg_version = true;

View File

@ -142,11 +142,22 @@ static void phpdbg_dump_prototype(zval *tmp) /* {{{ */
}
phpdbg_xml("<arg %r");
if (m && j < m) {
char *arg_name = NULL;
if (arginfo) {
if (func->type == ZEND_INTERNAL_FUNCTION) {
arg_name = (char *)((zend_internal_arg_info *)&arginfo[j])->name;
} else {
arg_name = arginfo[j].name->val;
}
}
if (!is_variadic) {
is_variadic = arginfo ? arginfo[j].is_variadic : 0;
}
phpdbg_xml(" variadic=\"%s\" name=\"%s\">", is_variadic ? "variadic" : "", arginfo ? arginfo[j].name : "");
phpdbg_out("%s=%s", arginfo ? arginfo[j].name : "?", is_variadic ? "[": "");
phpdbg_xml(" variadic=\"%s\" name=\"%s\">", is_variadic ? "variadic" : "", arg_name ? arg_name : "");
phpdbg_out("%s=%s", arg_name ? arg_name : "?", is_variadic ? "[": "");
} else {
phpdbg_xml(">");