felipe Wed Mar 25 12:05:51 2009 UTC Modified files: /php-src/ext/pdo pdo_dbh.c pdo_stmt.c Log: - Fixed some code to be working with unicode http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.164&r2=1.165&diff_format=u Index: php-src/ext/pdo/pdo_dbh.c diff -u php-src/ext/pdo/pdo_dbh.c:1.164 php-src/ext/pdo/pdo_dbh.c:1.165 --- php-src/ext/pdo/pdo_dbh.c:1.164 Mon Mar 23 23:58:49 2009 +++ php-src/ext/pdo/pdo_dbh.c Wed Mar 25 12:05:51 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_dbh.c,v 1.164 2009/03/23 23:58:49 felipe Exp $ */ +/* $Id: pdo_dbh.c,v 1.165 2009/03/25 12:05:51 felipe Exp $ */ /* The PDO Database Handle Class */ @@ -1033,9 +1033,9 @@ array_init(return_value); if (dbh->query_stmt) { - add_next_index_string(return_value, dbh->query_stmt->error_code, 1); + add_next_index_ascii_string(return_value, dbh->query_stmt->error_code, 1); } else { - add_next_index_string(return_value, dbh->error_code, 1); + add_next_index_ascii_string(return_value, dbh->error_code, 1); } if (dbh->methods->fetch_err) { @@ -1265,7 +1265,6 @@ const zend_function_entry *funcs; zend_function func; zend_internal_function *ifunc = (zend_internal_function*)&func; - int namelen; char *lc_name; if (!dbh || !dbh->methods || !dbh->methods->get_driver_methods) { @@ -1282,9 +1281,12 @@ zend_hash_init_ex(dbh->cls_methods[kind], 8, NULL, NULL, dbh->is_persistent, 0); while (funcs->fname) { + int namelen = strlen(funcs->fname)+1; + ifunc->type = ZEND_INTERNAL_FUNCTION; ifunc->handler = funcs->handler; - pdo_zstr_sval(ifunc->function_name) = (char*)funcs->fname; + ifunc->function_name.u = malloc(UBYTES(namelen)); + u_charsToUChars(funcs->fname, ifunc->function_name.u, namelen); ifunc->scope = dbh->ce; ifunc->prototype = NULL; if (funcs->arg_info) { @@ -1309,10 +1311,9 @@ } else { ifunc->fn_flags = ZEND_ACC_PUBLIC; } - namelen = strlen(funcs->fname); lc_name = emalloc(namelen+1); zend_str_tolower_copy(lc_name, funcs->fname, namelen); - zend_hash_add(dbh->cls_methods[kind], lc_name, namelen+1, &func, sizeof(func), NULL); + zend_ascii_hash_add(dbh->cls_methods[kind], lc_name, namelen+1, &func, sizeof(zend_function), NULL); efree(lc_name); funcs++; } @@ -1365,7 +1366,7 @@ } out: - if (std_object_handlers.get_method) { + if (!fbc && std_object_handlers.get_method) { fbc = std_object_handlers.get_method(object_pp, method_name, method_len TSRMLS_CC); } http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.218&r2=1.219&diff_format=u Index: php-src/ext/pdo/pdo_stmt.c diff -u php-src/ext/pdo/pdo_stmt.c:1.218 php-src/ext/pdo/pdo_stmt.c:1.219 --- php-src/ext/pdo/pdo_stmt.c:1.218 Tue Mar 24 19:32:06 2009 +++ php-src/ext/pdo/pdo_stmt.c Wed Mar 25 12:05:51 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_stmt.c,v 1.218 2009/03/24 19:32:06 felipe Exp $ */ +/* $Id: pdo_stmt.c,v 1.219 2009/03/25 12:05:51 felipe Exp $ */ /* The PDO Statement Handle Class */ @@ -1537,12 +1537,12 @@ /* no break */ case 2: stmt->fetch.cls.ctor_args = ctor_args; /* we're not going to free these */ - if (Z_TYPE_P(arg2) != IS_STRING) { + if (Z_TYPE_P(arg2) != IS_STRING && Z_TYPE_P(arg2) != IS_UNICODE) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Invalid class name (should be a string)" TSRMLS_CC); error = 1; break; } else { - stmt->fetch.cls.ce = zend_fetch_class(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + stmt->fetch.cls.ce = zend_u_fetch_class(Z_TYPE_P(arg2), Z_UNIVAL_P(arg2), Z_UNILEN_P(arg2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); if (!stmt->fetch.cls.ce) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not find user-specified class" TSRMLS_CC); error = 1; @@ -2746,9 +2746,11 @@ static union _zend_function *row_get_ctor(zval *object TSRMLS_DC) { static zend_internal_function ctor = {0}; + int namelen = sizeof("__construct"); ctor.type = ZEND_INTERNAL_FUNCTION; - pdo_zstr_sval(ctor.function_name) = "__construct"; + ctor.function_name.u = malloc(UBYTES(namelen)); + u_charsToUChars("__construct", ctor.function_name.u, namelen); ctor.scope = pdo_row_ce; ctor.handler = ZEND_FN(dbstmt_constructor);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php