From: Dmitry Stogov Date: Tue, 16 Aug 2005 15:09:51 +0000 (+0000) Subject: Unicode support X-Git-Tag: PRE_NEW_OCI8_EXTENSION~219 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0944d74f45d06059ae189aa40cf223cc9cbc8b2;p=php Unicode support --- diff --git a/ext/dom/tests/bug28817.phpt b/ext/dom/tests/bug28817.phpt index 26dd283c56..1d04ff3f1c 100644 --- a/ext/dom/tests/bug28817.phpt +++ b/ext/dom/tests/bug28817.phpt @@ -36,3 +36,15 @@ array(4) { string(4) "tiro" } string(30) "Cessante causa cessat effectus" +--UEXPECTF-- +array(4) { + [0]=> + unicode(5) "bonus" + [1]=> + unicode(3) "vir" + [2]=> + unicode(6) "semper" + [3]=> + unicode(4) "tiro" +} +unicode(30) "Cessante causa cessat effectus" diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index ba6859f851..b4f18efdb1 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -280,6 +280,7 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC) case IS_BOOL: case IS_DOUBLE: case IS_NULL: + case IS_UNICODE: if (value->refcount > 1) { value_copy = *value; zval_copy_ctor(&value_copy); @@ -288,6 +289,7 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC) convert_to_string(value); /* break missing intentionally */ case IS_STRING: + case IS_BINARY: xmlNodeSetContentLen(node, Z_STRVAL_P(value), Z_STRLEN_P(value)); if (value == &value_copy) { zval_dtor(value); @@ -427,8 +429,10 @@ next_iter: case IS_BOOL: case IS_DOUBLE: case IS_NULL: + case IS_UNICODE: convert_to_string(value); case IS_STRING: + case IS_BINARY: newnode = (xmlNodePtr)xmlNewProp(node, name, Z_STRVAL_P(value)); break; default: @@ -511,8 +515,10 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node); } else { + zval tmp_zv; + if (Z_TYPE_P(member) != IS_STRING) { - zval tmp_zv = *member; + tmp_zv = *member; zval_copy_ctor(&tmp_zv); member = &tmp_zv; convert_to_string(member); @@ -526,7 +532,10 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend } node = nnext; } - } + if (member == &tmp_zv) { + zval_dtor(&tmp_zv); + } + } if (node) { exists = 1; } @@ -681,7 +690,7 @@ sxe_properties_get(zval *object TSRMLS_DC) rv = sxe->properties; } else { ALLOC_HASHTABLE(rv); - zend_hash_init(rv, 0, NULL, ZVAL_PTR_DTOR, 0); + zend_u_hash_init(rv, 0, NULL, ZVAL_PTR_DTOR, 0, UG(unicode)); sxe->properties = rv; } @@ -698,6 +707,9 @@ sxe_properties_get(zval *object TSRMLS_DC) if (node->type == XML_TEXT_NODE) { MAKE_STD_ZVAL(value); ZVAL_STRING(value, xmlNodeListGetString(node->doc, node, 1), 1); + if (UG(unicode)) { + convert_to_unicode(value); + } zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL); goto next_iter; } @@ -999,6 +1011,12 @@ cast_object(zval *object, int type, char *contents TSRMLS_DC) case IS_STRING: convert_to_string(object); break; + case IS_BINARY: + convert_to_binary(object); + break; + case IS_UNICODE: + convert_to_unicode(object); + break; case IS_BOOL: convert_to_boolean(object); break; @@ -1506,11 +1524,20 @@ static int php_sxe_iterator_current_key(zend_object_iterator *iter, char **str_k curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->node)->node; } - namelen = xmlStrlen(curnode->name); - *str_key = estrndup(curnode->name, namelen); - *str_key_len = namelen + 1; - return HASH_KEY_IS_STRING; + if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + int32_t u_len; + namelen = xmlStrlen(curnode->name); + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), (UChar**)str_key, &u_len, (char*)curnode->name, namelen, &status); + *str_key_len = u_len + 1; + return HASH_KEY_IS_UNICODE; + } else { + namelen = xmlStrlen(curnode->name); + *str_key = estrndup(curnode->name, namelen); + *str_key_len = namelen + 1; + return HASH_KEY_IS_STRING; + } } ZEND_API void php_sxe_move_forward_iterator(php_sxe_object *sxe TSRMLS_DC) diff --git a/ext/simplexml/tests/008.phpt b/ext/simplexml/tests/008.phpt index 3554b32040..76b6ec8fe8 100644 --- a/ext/simplexml/tests/008.phpt +++ b/ext/simplexml/tests/008.phpt @@ -37,3 +37,13 @@ array(1) { } } bool(false) +--UEXPECTF-- +array(1) { + [0]=> + object(SimpleXMLElement)#%d (1) { + [u"test"]=> + object(SimpleXMLElement)#%d (0) { + } + } +} +bool(false) diff --git a/ext/simplexml/tests/009.phpt b/ext/simplexml/tests/009.phpt index a5502ac4aa..83f4629ce4 100755 --- a/ext/simplexml/tests/009.phpt +++ b/ext/simplexml/tests/009.phpt @@ -31,7 +31,7 @@ EOF foreach($sxe->children() as $name=>$val) { var_dump($name); var_dump(get_class($val)); - var_dump(trim((string)$val)); + var_dump(trim($val)); } ?> ===DONE=== diff --git a/ext/simplexml/tests/015.phpt b/ext/simplexml/tests/015.phpt index 11e9cd55cd..aa827d72d8 100644 --- a/ext/simplexml/tests/015.phpt +++ b/ext/simplexml/tests/015.phpt @@ -54,3 +54,21 @@ object(SimpleXMLElement)#%d (1) { string(3) "Boe" } ===DONE=== +--UEXPECTF-- +object(SimpleXMLElement)#%d (1) { + [0]=> + unicode(3) "Joe" +} +object(SimpleXMLElement)#%d (1) { + [0]=> + unicode(3) "Joe" +} +object(SimpleXMLElement)#%d (1) { + [0]=> + unicode(3) "Joe" +} +object(SimpleXMLElement)#%d (1) { + [0]=> + unicode(3) "Boe" +} +===DONE=== diff --git a/ext/simplexml/tests/022.phpt b/ext/simplexml/tests/022.phpt index 08cb908c9c..4a646205d5 100755 --- a/ext/simplexml/tests/022.phpt +++ b/ext/simplexml/tests/022.phpt @@ -28,3 +28,11 @@ object(SimpleXMLElement)#%d (1) { string(11) "slide_*.xml" } ===DONE=== +--UEXPECTF-- +object(SimpleXMLElement)#%d (0) { +} +object(SimpleXMLElement)#%d (1) { + [0]=> + unicode(11) "slide_*.xml" +} +===DONE=== diff --git a/ext/spl/spl_sxe.c b/ext/spl/spl_sxe.c index 5880bfb0bf..aedad3dc43 100755 --- a/ext/spl/spl_sxe.c +++ b/ext/spl/spl_sxe.c @@ -80,7 +80,16 @@ SPL_METHOD(SimpleXMLIterator, key) /* {{{ */ intern = (php_sxe_object *)zend_object_store_get_object(sxe->iter.data TSRMLS_CC); if (intern != NULL && intern->node != NULL) { curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->node)->node; - RETURN_STRINGL((char*)curnode->name, xmlStrlen(curnode->name), 1); + if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, (char*)curnode->name, xmlStrlen(curnode->name), &status); + RETURN_UNICODEL(u_str, u_len, 0); + } else { + RETURN_STRINGL((char*)curnode->name, xmlStrlen(curnode->name), 1); + } } RETURN_FALSE; diff --git a/ext/spl/tests/sxe_002.phpt b/ext/spl/tests/sxe_002.phpt index ea9edd39f7..4734625fcd 100755 --- a/ext/spl/tests/sxe_002.phpt +++ b/ext/spl/tests/sxe_002.phpt @@ -75,3 +75,26 @@ string(7) "Foo Bar" string(17) "SimpleXMLIterator" string(10) "Bla bla 1." ===DONE=== +--UEXPECT-- +unicode(5) "elem1" +unicode(17) "SimpleXMLIterator" +unicode(10) "Bla bla 1." +unicode(5) "elem2" +unicode(17) "SimpleXMLIterator" +unicode(28) "Here we have some text data." +unicode(5) "elem3" +unicode(17) "SimpleXMLIterator" +unicode(19) "And here some more." +unicode(5) "elem4" +unicode(17) "SimpleXMLIterator" +unicode(15) "Wow once again." +unicode(6) "elem11" +unicode(17) "SimpleXMLIterator" +unicode(10) "Bla bla 2." +unicode(7) "elem111" +unicode(17) "SimpleXMLIterator" +unicode(7) "Foo Bar" +===DUMP=== +unicode(17) "SimpleXMLIterator" +unicode(10) "Bla bla 1." +===DONE=== diff --git a/ext/spl/tests/sxe_003.phpt b/ext/spl/tests/sxe_003.phpt index e222af6eb9..0d09b4ea6e 100755 --- a/ext/spl/tests/sxe_003.phpt +++ b/ext/spl/tests/sxe_003.phpt @@ -77,3 +77,20 @@ string(7) "elem111" string(17) "SimpleXMLIterator" string(7) "Foo Bar" ===DONE=== +--UEXPECTF-- + +Warning: Invalid argument supplied for foreach() in %ssxe_003.php on line %d +===RESET=== +bool(true) +unicode(5) "elem1" +unicode(10) "Bla bla 1." +unicode(5) "elem2" +unicode(17) "SimpleXMLIterator" +unicode(28) "Here we have some text data." +bool(true) +unicode(6) "elem11" +unicode(10) "Bla bla 2." +unicode(7) "elem111" +unicode(17) "SimpleXMLIterator" +unicode(7) "Foo Bar" +===DONE=== diff --git a/ext/spl/tests/sxe_004.phpt b/ext/spl/tests/sxe_004.phpt index 98865955ad..3ef99514fe 100755 --- a/ext/spl/tests/sxe_004.phpt +++ b/ext/spl/tests/sxe_004.phpt @@ -145,3 +145,62 @@ SXETest::next SXETest::valid SXETest::valid ===DONE=== +--UEXPECTF-- +SXETest::rewind +SXETest::valid +SXETest::hasChildren +SXETest::valid +SXETest::current +unicode(7) "SXETest" +unicode(10) "Bla bla 1." +SXETest::getChildren +SXETest::rewind +SXETest::valid +SXETest::hasChildren +SXETest::valid +SXETest::current +unicode(7) "SXETest" +unicode(28) "Here we have some text data." +SXETest::getChildren +SXETest::rewind +SXETest::valid +SXETest::hasChildren +SXETest::valid +SXETest::current +unicode(7) "SXETest" +unicode(19) "And here some more." +SXETest::getChildren +SXETest::rewind +SXETest::valid +SXETest::hasChildren +SXETest::valid +SXETest::current +unicode(7) "SXETest" +unicode(15) "Wow once again." +SXETest::next +SXETest::valid +SXETest::next +SXETest::valid +SXETest::next +SXETest::valid +SXETest::next +SXETest::valid +SXETest::hasChildren +SXETest::valid +SXETest::current +unicode(7) "SXETest" +unicode(10) "Bla bla 2." +SXETest::getChildren +SXETest::rewind +SXETest::valid +SXETest::hasChildren +SXETest::valid +SXETest::current +unicode(7) "SXETest" +unicode(7) "Foo Bar" +SXETest::next +SXETest::valid +SXETest::next +SXETest::valid +SXETest::valid +===DONE=== diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index dea30603de..2395d9909c 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -876,12 +876,12 @@ static zend_object_value sqlite_object_new_exception(zend_class_entry *class_typ static zend_class_entry *sqlite_get_ce_query(zval *object TSRMLS_DC) { - return sqlite_ce_query; + return U_CLASS_ENTRY(sqlite_ce_query); } static zend_class_entry *sqlite_get_ce_ub_query(zval *object TSRMLS_DC) { - return sqlite_ce_ub_query; + return U_CLASS_ENTRY(sqlite_ce_ub_query); } static zval * sqlite_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC) @@ -1183,7 +1183,7 @@ static struct php_sqlite_db *php_sqlite_open(char *filename, int mode, char *per if (object) { /* if object is not an object then we're called from the factory() function */ if (Z_TYPE_P(object) != IS_OBJECT) { - sqlite_instanciate(sqlite_ce_db, object TSRMLS_CC); + sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_db), object TSRMLS_CC); } /* and now register the object */ SQLITE_REGISTER_OBJECT(db, object, db) @@ -1290,7 +1290,7 @@ PHP_FUNCTION(sqlite_open) zval *errmsg = NULL; zval *object = getThis(); - php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC); + php_set_error_handling(object ? EH_THROW : EH_NORMAL, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", &filename, &filename_len, &mode, &errmsg)) { php_std_error_handling(); @@ -1345,7 +1345,7 @@ PHP_FUNCTION(sqlite_factory) int filename_len; zval *errmsg = NULL; - php_set_error_handling(EH_THROW, sqlite_ce_exception TSRMLS_CC); + php_set_error_handling(EH_THROW, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/", &filename, &filename_len, &mode, &errmsg)) { php_std_error_handling(); @@ -1570,9 +1570,9 @@ terminate: if (object) { sqlite_object *obj; if (buffered) { - sqlite_instanciate(sqlite_ce_query, return_value TSRMLS_CC); + sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_query), return_value TSRMLS_CC); } else { - sqlite_instanciate(sqlite_ce_ub_query, return_value TSRMLS_CC); + sqlite_instanciate(U_CLASS_ENTRY(sqlite_ce_ub_query), return_value TSRMLS_CC); } obj = (sqlite_object *) zend_object_store_get_object(return_value TSRMLS_CC); obj->type = is_result; @@ -1685,11 +1685,27 @@ PHP_FUNCTION(sqlite_fetch_column_types) php_sqlite_strtolower(colname); } - if (result_type == PHPSQLITE_ASSOC) { - add_assoc_string(return_value, colname, colnames[ncols + i] ? (char *)colnames[ncols + i] : "", 1); - } - if (result_type == PHPSQLITE_NUM) { - add_index_string(return_value, i, colnames[ncols + i] ? (char *)colnames[ncols + i] : "", 1); + if (UG(unicode)) { + char *tmp = colnames[ncols + i] ? (char *)colnames[ncols + i] : ""; + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, tmp, strlen(tmp), &status); + if (result_type == PHPSQLITE_ASSOC) { + add_assoc_unicode(return_value, colname, u_str, 1); + } + if (result_type == PHPSQLITE_NUM) { + add_index_unicode(return_value, i, u_str, 1); + } + efree(u_str); + } else { + if (result_type == PHPSQLITE_ASSOC) { + add_assoc_string(return_value, colname, colnames[ncols + i] ? (char *)colnames[ncols + i] : "", 1); + } + if (result_type == PHPSQLITE_NUM) { + add_index_string(return_value, i, colnames[ncols + i] ? (char *)colnames[ncols + i] : "", 1); + } } } @@ -1811,13 +1827,25 @@ static void php_sqlite_fetch_array(struct php_sqlite_result *res, int mode, zend Z_STRVAL_P(decoded) = emalloc(strlen(rowdata[j])); Z_STRLEN_P(decoded) = php_sqlite_decode_binary(rowdata[j]+1, Z_STRVAL_P(decoded)); Z_STRVAL_P(decoded)[Z_STRLEN_P(decoded)] = '\0'; - Z_TYPE_P(decoded) = IS_STRING; + Z_TYPE_P(decoded) = UG(unicode)?IS_BINARY:IS_STRING; if (!buffered) { efree((char*)rowdata[j]); rowdata[j] = NULL; } } else { - ZVAL_STRING(decoded, (char*)rowdata[j], buffered); + if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, (char*)rowdata[j], strlen((char*)rowdata[j]), &status); + ZVAL_UNICODEL(decoded, u_str, u_len, 0); + if (!buffered) { + efree(rowdata[j]); + } + } else { + ZVAL_STRING(decoded, (char*)rowdata[j], buffered); + } if (!buffered) { rowdata[j] = NULL; } @@ -1888,11 +1916,26 @@ static void php_sqlite_fetch_column(struct php_sqlite_result *res, zval *which, char *decoded = emalloc(l); l = php_sqlite_decode_binary(rowdata[j]+1, decoded); decoded[l] = '\0'; - RETVAL_STRINGL(decoded, l, 0); + if (UG(unicode)) { + RETVAL_BINARYL(decoded, l, 0); + } else { + RETVAL_STRINGL(decoded, l, 0); + } if (!res->buffered) { efree((char*)rowdata[j]); rowdata[j] = NULL; } + } else if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, (char*)rowdata[j], strlen((char*)rowdata[j]), &status); + RETVAL_UNICODEL(u_str, u_len, 0); + if (!res->buffered) { + efree(rowdata[j]); + rowdata[j] = NULL; + } } else { RETVAL_STRING((char*)rowdata[j], res->buffered); if (!res->buffered) { @@ -1997,34 +2040,35 @@ PHP_FUNCTION(sqlite_fetch_object) zend_fcall_info_cache fcc; zval *retval_ptr; zval *ctor_params = NULL; + zend_uchar class_name_type; - php_set_error_handling(object ? EH_THROW : EH_NORMAL, sqlite_ce_exception TSRMLS_CC); + php_set_error_handling(object ? EH_THROW : EH_NORMAL, U_CLASS_ENTRY(sqlite_ce_exception) TSRMLS_CC); if (object) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|szb", &class_name, &class_name_len, &ctor_params, &decode_binary)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|tzb", &class_name, &class_name_len, &class_name_type, &ctor_params, &decode_binary)) { php_std_error_handling(); return; } RES_FROM_OBJECT(res, object); if (!ZEND_NUM_ARGS()) { - ce = zend_standard_class_def; + ce = U_CLASS_ENTRY(zend_standard_class_def); } else { - ce = zend_fetch_class(class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + ce = zend_u_fetch_class(class_name_type, class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); } } else { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|szb", &zres, &class_name, &class_name_len, &ctor_params, &decode_binary)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|tzb", &zres, &class_name, &class_name_len, &class_name_type, &ctor_params, &decode_binary)) { php_std_error_handling(); return; } ZEND_FETCH_RESOURCE(res, struct php_sqlite_result *, &zres, -1, "sqlite result", le_sqlite_result); if (ZEND_NUM_ARGS() < 2) { - ce = zend_standard_class_def; + ce = U_CLASS_ENTRY(zend_standard_class_def); } else { - ce = zend_fetch_class(class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + ce = zend_u_fetch_class(class_name_type, class_name, class_name_len, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); } } if (!ce) { - zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not find class '%s'", class_name); + zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Could not find class '%s'", class_name); php_std_error_handling(); return; } @@ -2067,7 +2111,7 @@ PHP_FUNCTION(sqlite_fetch_object) * single value is an array. Also we'd have to make that one * argument passed by reference. */ - zend_throw_exception(sqlite_ce_exception, "Parameter ctor_params must be an array", 0 TSRMLS_CC); + zend_throw_exception(U_CLASS_ENTRY(sqlite_ce_exception), "Parameter ctor_params must be an array", 0 TSRMLS_CC); return; } } else { @@ -2082,7 +2126,7 @@ PHP_FUNCTION(sqlite_fetch_object) fcc.object_pp = &return_value; if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { - zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Could not execute %s::%v()", class_name, ce->constructor->common.function_name); + zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Could not execute %s::%v()", class_name, ce->constructor->common.function_name); } else { if (retval_ptr) { zval_ptr_dtor(&retval_ptr); @@ -2092,7 +2136,7 @@ PHP_FUNCTION(sqlite_fetch_object) efree(fci.params); } } else if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { - zend_throw_exception_ex(sqlite_ce_exception, 0 TSRMLS_CC, "Class %s does not have a constructor, use NULL for parameter ctor_params or omit it", class_name); + zend_throw_exception_ex(U_CLASS_ENTRY(sqlite_ce_exception), 0 TSRMLS_CC, "Class %s does not have a constructor, use NULL for parameter ctor_params or omit it", class_name); } } /* }}} */ @@ -2164,6 +2208,7 @@ static void php_sqlite_fetch_single(struct php_sqlite_result *res, zend_bool dec const char **rowdata; char *decoded; int decoded_len; + int free_decoded = 0; /* check range of the row */ if (res->curr_row >= res->nrows) { @@ -2184,13 +2229,19 @@ static void php_sqlite_fetch_single(struct php_sqlite_result *res, zend_bool dec efree((char*)rowdata[0]); rowdata[0] = NULL; } + free_decoded = 1; } else if (rowdata[0]) { decoded_len = strlen((char*)rowdata[0]); if (res->buffered) { - decoded = estrndup((char*)rowdata[0], decoded_len); + if (UG(unicode)) { + decoded = (char*)rowdata[0]; + } else { + decoded = estrndup((char*)rowdata[0], decoded_len); + } } else { decoded = (char*)rowdata[0]; rowdata[0] = NULL; + free_decoded = 1; } } else { decoded = NULL; @@ -2206,6 +2257,16 @@ static void php_sqlite_fetch_single(struct php_sqlite_result *res, zend_bool dec if (decoded == NULL) { RETURN_NULL(); + } else if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, decoded, decoded_len, &status); + if (free_decoded) { + efree(decoded); + } + RETURN_UNICODEL(u_str, u_len, 0); } else { RETURN_STRINGL(decoded, decoded_len, 0); } @@ -2382,7 +2443,13 @@ PHP_FUNCTION(sqlite_libversion) if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } - RETURN_STRING((char*)sqlite_libversion(), 1); + if (UG(unicode)) { + char *temp = (char*)sqlite_libversion(); + UChar *u_temp = zend_ascii_to_unicode(temp, strlen(temp)+1 ZEND_FILE_LINE_CC); + RETURN_UNICODE(u_temp, 0); + } else { + RETURN_STRING((char*)sqlite_libversion(), 1); + } } /* }}} */ @@ -2393,7 +2460,13 @@ PHP_FUNCTION(sqlite_libencoding) if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; } - RETURN_STRING((char*)sqlite_libencoding(), 1); + if (UG(unicode)) { + char *temp = (char*)sqlite_libencoding(); + UChar *u_temp = zend_ascii_to_unicode(temp, strlen(temp)+1 ZEND_FILE_LINE_CC); + RETURN_UNICODE(u_temp, 0); + } else { + RETURN_STRING((char*)sqlite_libencoding(), 1); + } } /* }}} */ @@ -2453,7 +2526,7 @@ static int sqlite_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */ * count = obj->u.res->nrows; return SUCCESS; } else { - zend_throw_exception(sqlite_ce_exception, "Row count is not available for unbuffered queries", 0 TSRMLS_CC); + zend_throw_exception(U_CLASS_ENTRY(sqlite_ce_exception), "Row count is not available for unbuffered queries", 0 TSRMLS_CC); return FAILURE; } } /* }}} */ @@ -2590,7 +2663,16 @@ PHP_FUNCTION(sqlite_field_name) RETURN_FALSE; } - RETURN_STRING(res->col_names[field], 1); + if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, res->col_names[field], strlen(res->col_names[field]), &status); + RETURN_UNICODEL(u_str, u_len, 0); + } else { + RETURN_STRING(res->col_names[field], 1); + } } /* }}} */ @@ -2831,7 +2913,16 @@ PHP_FUNCTION(sqlite_error_string) msg = sqlite_error_string(code); if (msg) { - RETURN_STRING((char*)msg, 1); + if (UG(unicode)) { + UErrorCode status = U_ZERO_ERROR; + UChar *u_str; + int32_t u_len; + + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, msg, strlen(msg), &status); + RETURN_UNICODEL(u_str, u_len, 0); + } else { + RETURN_STRING((char*)msg, 1); + } } else { RETURN_NULL(); } diff --git a/ext/sqlite/tests/sqlite_002.phpt b/ext/sqlite/tests/sqlite_002.phpt index c9fd0e1bca..325d798653 100755 --- a/ext/sqlite/tests/sqlite_002.phpt +++ b/ext/sqlite/tests/sqlite_002.phpt @@ -30,3 +30,18 @@ array(6) { ["c3"]=> NULL } +--UEXPECT-- +array(6) { + [0]=> + unicode(10) "2002-01-02" + [u"c1"]=> + unicode(10) "2002-01-02" + [1]=> + unicode(8) "12:49:00" + [u"c2"]=> + unicode(8) "12:49:00" + [2]=> + NULL + [u"c3"]=> + NULL +} diff --git a/ext/sqlite/tests/sqlite_003.phpt b/ext/sqlite/tests/sqlite_003.phpt index adb891b726..4269638470 100755 --- a/ext/sqlite/tests/sqlite_003.phpt +++ b/ext/sqlite/tests/sqlite_003.phpt @@ -50,3 +50,34 @@ array(3) { ["c3"]=> NULL } +--UEXPECT-- +array(6) { + [0]=> + unicode(10) "2002-01-02" + [u"c1"]=> + unicode(10) "2002-01-02" + [1]=> + unicode(8) "12:49:00" + [u"c2"]=> + unicode(8) "12:49:00" + [2]=> + NULL + [u"c3"]=> + NULL +} +array(3) { + [0]=> + unicode(10) "2002-01-02" + [1]=> + unicode(8) "12:49:00" + [2]=> + NULL +} +array(3) { + [u"c1"]=> + unicode(10) "2002-01-02" + [u"c2"]=> + unicode(8) "12:49:00" + [u"c3"]=> + NULL +} diff --git a/ext/sqlite/tests/sqlite_005.phpt b/ext/sqlite/tests/sqlite_005.phpt index e0eeab5589..4acdebddf4 100644 --- a/ext/sqlite/tests/sqlite_005.phpt +++ b/ext/sqlite/tests/sqlite_005.phpt @@ -48,3 +48,9 @@ array(1) { string(11) "onetwothree" } DONE! +--UEXPECT-- +array(1) { + [0]=> + unicode(11) "onetwothree" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_006.phpt b/ext/sqlite/tests/sqlite_006.phpt index 4e6e5f19ed..409d7e49c0 100644 --- a/ext/sqlite/tests/sqlite_006.phpt +++ b/ext/sqlite/tests/sqlite_006.phpt @@ -53,3 +53,17 @@ array(1) { string(10) "three-tres" } DONE! +--UEXPECT-- +array(1) { + [0]=> + unicode(7) "one-uno" +} +array(1) { + [0]=> + unicode(7) "two-dos" +} +array(1) { + [0]=> + unicode(10) "three-tres" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_007.phpt b/ext/sqlite/tests/sqlite_007.phpt index 5a1e536188..5635e9e793 100755 --- a/ext/sqlite/tests/sqlite_007.phpt +++ b/ext/sqlite/tests/sqlite_007.phpt @@ -50,3 +50,34 @@ array(3) { ["c3"]=> NULL } +--UEXPECT-- +array(6) { + [0]=> + unicode(10) "2002-01-02" + [u"c1"]=> + unicode(10) "2002-01-02" + [1]=> + unicode(8) "12:49:00" + [u"c2"]=> + unicode(8) "12:49:00" + [2]=> + NULL + [u"c3"]=> + NULL +} +array(3) { + [0]=> + unicode(10) "2002-01-02" + [1]=> + unicode(8) "12:49:00" + [2]=> + NULL +} +array(3) { + [u"c1"]=> + unicode(10) "2002-01-02" + [u"c2"]=> + unicode(8) "12:49:00" + [u"c3"]=> + NULL +} diff --git a/ext/sqlite/tests/sqlite_008.phpt b/ext/sqlite/tests/sqlite_008.phpt index ee485c76a1..5e5950b34e 100755 --- a/ext/sqlite/tests/sqlite_008.phpt +++ b/ext/sqlite/tests/sqlite_008.phpt @@ -44,3 +44,17 @@ array(1) { string(5) "three" } DONE! +--UEXPECT-- +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_009.phpt b/ext/sqlite/tests/sqlite_009.phpt index bdad770b57..de45b03be9 100755 --- a/ext/sqlite/tests/sqlite_009.phpt +++ b/ext/sqlite/tests/sqlite_009.phpt @@ -44,3 +44,17 @@ array(1) { string(5) "three" } DONE! +--UEXPECT-- +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_010.phpt b/ext/sqlite/tests/sqlite_010.phpt index 152fde4cf0..f13d95ffd9 100755 --- a/ext/sqlite/tests/sqlite_010.phpt +++ b/ext/sqlite/tests/sqlite_010.phpt @@ -79,3 +79,41 @@ array(1) { string(5) "three" } DONE! +--UEXPECT-- +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_011.phpt b/ext/sqlite/tests/sqlite_011.phpt index 9c1bf3990f..e24d1d8639 100755 --- a/ext/sqlite/tests/sqlite_011.phpt +++ b/ext/sqlite/tests/sqlite_011.phpt @@ -32,3 +32,18 @@ array(6) { ["bar.c3"]=> string(1) "6" } +--UEXPECT-- +array(6) { + [u"foo.c1"]=> + unicode(1) "1" + [u"foo.c2"]=> + unicode(1) "2" + [u"foo.c3"]=> + unicode(1) "3" + [u"bar.c1"]=> + unicode(1) "4" + [u"bar.c2"]=> + unicode(1) "5" + [u"bar.c3"]=> + unicode(1) "6" +} diff --git a/ext/sqlite/tests/sqlite_012.phpt b/ext/sqlite/tests/sqlite_012.phpt index 14d9ea4f53..b8b89e558e 100755 --- a/ext/sqlite/tests/sqlite_012.phpt +++ b/ext/sqlite/tests/sqlite_012.phpt @@ -36,3 +36,13 @@ string(3) "foo" string(3) "bar" string(3) "baz" DONE! +--UEXPECT-- +Buffered +unicode(3) "foo" +unicode(3) "bar" +unicode(3) "baz" +Unbuffered +unicode(3) "foo" +unicode(3) "bar" +unicode(3) "baz" +DONE! diff --git a/ext/sqlite/tests/sqlite_013.phpt b/ext/sqlite/tests/sqlite_013.phpt index 95b047a75c..4ed0e7856a 100755 --- a/ext/sqlite/tests/sqlite_013.phpt +++ b/ext/sqlite/tests/sqlite_013.phpt @@ -76,3 +76,35 @@ string(4) "four" NULL NULL DONE! +--UEXPECT-- +====BUFFERED==== +array(2) { + [0]=> + unicode(3) "one" + [1]=> + unicode(3) "two" +} +unicode(3) "one" +unicode(3) "two" +unicode(3) "one" +unicode(3) "two" +array(2) { + [0]=> + unicode(5) "three" + [1]=> + unicode(4) "four" +} +unicode(5) "three" +unicode(4) "four" +unicode(5) "three" +unicode(4) "four" +====UNBUFFERED==== +unicode(3) "one" +unicode(3) "two" +NULL +NULL +unicode(5) "three" +unicode(4) "four" +NULL +NULL +DONE! diff --git a/ext/sqlite/tests/sqlite_014.phpt b/ext/sqlite/tests/sqlite_014.phpt index 967fcc10fa..6ecad25e49 100755 --- a/ext/sqlite/tests/sqlite_014.phpt +++ b/ext/sqlite/tests/sqlite_014.phpt @@ -118,3 +118,80 @@ array(3) { } } DONE! +--UEXPECTF-- +unbuffered twice +array(3) { + [0]=> + array(1) { + [0]=> + unicode(3) "one" + } + [1]=> + array(1) { + [0]=> + unicode(3) "two" + } + [2]=> + array(1) { + [0]=> + unicode(5) "three" + } +} + +Warning: sqlite_fetch_all(): One or more rowsets were already returned; returning NULL this time in %ssqlite_014.php on line %d +array(0) { +} +unbuffered with fetch_array +array(1) { + [0]=> + unicode(3) "one" +} +array(2) { + [0]=> + array(1) { + [0]=> + unicode(3) "two" + } + [1]=> + array(1) { + [0]=> + unicode(5) "three" + } +} +buffered +array(3) { + [0]=> + array(1) { + [0]=> + unicode(3) "one" + } + [1]=> + array(1) { + [0]=> + unicode(3) "two" + } + [2]=> + array(1) { + [0]=> + unicode(5) "three" + } +} +bool(false) +array(3) { + [0]=> + array(1) { + [0]=> + unicode(3) "one" + } + [1]=> + array(1) { + [0]=> + unicode(3) "two" + } + [2]=> + array(1) { + [0]=> + unicode(5) "three" + } +} +DONE! diff --git a/ext/sqlite/tests/sqlite_015.phpt b/ext/sqlite/tests/sqlite_015.phpt index 8de42a84b9..e78e02cf7a 100755 --- a/ext/sqlite/tests/sqlite_015.phpt +++ b/ext/sqlite/tests/sqlite_015.phpt @@ -47,3 +47,22 @@ array(3) { } } DONE! +--UEXPECTF-- +array(3) { + [0]=> + array(1) { + [0]=> + unicode(3) "one" + } + [1]=> + array(1) { + [0]=> + unicode(3) "two" + } + [2]=> + array(1) { + [0]=> + unicode(5) "three" + } +} +DONE! diff --git a/ext/sqlite/tests/sqlite_016.phpt b/ext/sqlite/tests/sqlite_016.phpt index 9ca9de135f..30c2ca7d6d 100755 --- a/ext/sqlite/tests/sqlite_016.phpt +++ b/ext/sqlite/tests/sqlite_016.phpt @@ -43,3 +43,11 @@ string(5) "three" string(3) "one" string(5) "three" DONE! +--UEXPECT-- +====BUFFERED==== +unicode(3) "one" +unicode(5) "three" +====UNBUFFERED==== +unicode(3) "one" +unicode(5) "three" +DONE! diff --git a/ext/sqlite/tests/sqlite_019.phpt b/ext/sqlite/tests/sqlite_019.phpt index 74dcff99fa..f03dac85b2 100755 --- a/ext/sqlite/tests/sqlite_019.phpt +++ b/ext/sqlite/tests/sqlite_019.phpt @@ -45,3 +45,25 @@ array(1) { [0]=> string(1) "5" } +--UEXPECTF-- +unicode(1) "5" +unicode(1) "4" +unicode(5) "5data" +array(4) { + [0]=> + unicode(1) "1" + [1]=> + unicode(1) "2" + [2]=> + unicode(1) "3" + [3]=> + unicode(1) "4" +} + +Warning: sqlite_single_query(): no such table: test in %s on line %d +bool(false) +NULL +array(1) { + [0]=> + unicode(1) "5" +} diff --git a/ext/sqlite/tests/sqlite_022.phpt b/ext/sqlite/tests/sqlite_022.phpt index 76921d56f6..492edbceee 100755 --- a/ext/sqlite/tests/sqlite_022.phpt +++ b/ext/sqlite/tests/sqlite_022.phpt @@ -99,3 +99,64 @@ array(1) { string(5) "three" } ====DONE!==== +--UEXPECTF-- +====SEEK:-1==== + +Warning: sqlite_seek(): row -1 out of range in %ssqlite_022.php on line %d +array(1) { + [0]=> + unicode(3) "one" +} +====SEEK:0==== +array(1) { + [0]=> + unicode(3) "one" +} +====SEEK:1==== +array(1) { + [0]=> + unicode(3) "two" +} +====SEEK:2==== +array(1) { + [0]=> + unicode(5) "three" +} +====SEEK:3==== + +Warning: sqlite_seek(): row 3 out of range in %ssqlite_022.php on line %d +array(1) { + [0]=> + unicode(5) "three" +} +====AGAIN==== +====SEEK:-1==== + +Warning: sqlite_seek(): row -1 out of range in %ssqlite_022.php on line %d +array(1) { + [0]=> + unicode(5) "three" +} +====SEEK:0==== +array(1) { + [0]=> + unicode(3) "one" +} +====SEEK:1==== +array(1) { + [0]=> + unicode(3) "two" +} +====SEEK:2==== +array(1) { + [0]=> + unicode(5) "three" +} +====SEEK:3==== + +Warning: sqlite_seek(): row 3 out of range in %ssqlite_022.php on line %d +array(1) { + [0]=> + unicode(5) "three" +} +====DONE!==== diff --git a/ext/sqlite/tests/sqlite_023.phpt b/ext/sqlite/tests/sqlite_023.phpt index fbb8dc8da8..b36eed1815 100644 --- a/ext/sqlite/tests/sqlite_023.phpt +++ b/ext/sqlite/tests/sqlite_023.phpt @@ -103,3 +103,53 @@ bool(false) Warning: sqlite_has_prev(): you cannot use sqlite_has_prev on unbuffered querys in %ssqlite_023.php on line %d ====DONE!==== +--UEXPECTF-- +====TRAVERSE==== +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +====REVERSE==== +array(1) { + [0]=> + unicode(5) "three" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(3) "one" +} +====UNBUFFERED==== +====TRAVERSE==== + +Warning: sqlite_rewind(): Cannot rewind an unbuffered result set in %ssqlite_023.php on line %d +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +====REVERSE==== + +Warning: sqlite_prev(): you cannot use sqlite_prev on unbuffered querys in %ssqlite_023.php on line %d +bool(false) + +Warning: sqlite_has_prev(): you cannot use sqlite_has_prev on unbuffered querys in %ssqlite_023.php on line %d +====DONE!==== diff --git a/ext/sqlite/tests/sqlite_024.phpt b/ext/sqlite/tests/sqlite_024.phpt index b7198c0155..0912217737 100755 --- a/ext/sqlite/tests/sqlite_024.phpt +++ b/ext/sqlite/tests/sqlite_024.phpt @@ -74,3 +74,34 @@ object(stdClass)#%d (1) { string(5) "three" } ====DONE!==== +--UEXPECTF-- +====class24==== +class24::__construct +object(class24)#%d (1) { + [u"a"]=> + unicode(3) "one" +} +class24::__construct +object(class24)#%d (1) { + [u"a"]=> + unicode(3) "two" +} +class24::__construct +object(class24)#%d (1) { + [u"a"]=> + unicode(5) "three" +} +====stdclass==== +object(stdClass)#%d (1) { + [u"a"]=> + unicode(3) "one" +} +object(stdClass)#%d (1) { + [u"a"]=> + unicode(3) "two" +} +object(stdClass)#%d (1) { + [u"a"]=> + unicode(5) "three" +} +====DONE!==== diff --git a/ext/sqlite/tests/sqlite_025.phpt b/ext/sqlite/tests/sqlite_025.phpt index 0a257610cc..a9b7829eea 100755 --- a/ext/sqlite/tests/sqlite_025.phpt +++ b/ext/sqlite/tests/sqlite_025.phpt @@ -35,4 +35,17 @@ object(stdClass)#2 (1) { object(stdClass)#1 (1) { ["a"]=> string(5) "three" -} \ No newline at end of file +} +--UEXPECTF-- +object(stdClass)#1 (1) { + [u"a"]=> + unicode(3) "one" +} +object(stdClass)#2 (1) { + [u"a"]=> + unicode(3) "two" +} +object(stdClass)#1 (1) { + [u"a"]=> + unicode(5) "three" +} diff --git a/ext/sqlite/tests/sqlite_026.phpt b/ext/sqlite/tests/sqlite_026.phpt index c508979a27..5b5c3504ec 100755 --- a/ext/sqlite/tests/sqlite_026.phpt +++ b/ext/sqlite/tests/sqlite_026.phpt @@ -25,3 +25,14 @@ array(4) { ["d"]=> string(0) "" } +--UEXPECT-- +array(4) { + [u"a"]=> + unicode(0) "" + [u"b"]=> + unicode(7) "INTEGER" + [u"c"]=> + unicode(11) "VARCHAR(10)" + [u"d"]=> + unicode(0) "" +} diff --git a/ext/sqlite/tests/sqlite_oo_002.phpt b/ext/sqlite/tests/sqlite_oo_002.phpt index 00a568a2a8..6ab9996549 100755 --- a/ext/sqlite/tests/sqlite_oo_002.phpt +++ b/ext/sqlite/tests/sqlite_oo_002.phpt @@ -39,3 +39,26 @@ array(6) { ["c3"]=> NULL } +--UEXPECTF-- +object(SQLiteDatabase)#%d (0) { +} +object(SQLiteResult)#%d (0) { +} +object(SQLiteResult)#%d (0) { +} +object(SQLiteResult)#%d (0) { +} +array(6) { + [0]=> + unicode(10) "2002-01-02" + [u"c1"]=> + unicode(10) "2002-01-02" + [1]=> + unicode(8) "12:49:00" + [u"c2"]=> + unicode(8) "12:49:00" + [2]=> + NULL + [u"c3"]=> + NULL +} diff --git a/ext/sqlite/tests/sqlite_oo_003.phpt b/ext/sqlite/tests/sqlite_oo_003.phpt index f9ca65c611..00d6465945 100755 --- a/ext/sqlite/tests/sqlite_oo_003.phpt +++ b/ext/sqlite/tests/sqlite_oo_003.phpt @@ -49,3 +49,34 @@ array(3) { ["c3"]=> NULL } +--UEXPECT-- +array(6) { + [0]=> + unicode(10) "2002-01-02" + [u"c1"]=> + unicode(10) "2002-01-02" + [1]=> + unicode(8) "12:49:00" + [u"c2"]=> + unicode(8) "12:49:00" + [2]=> + NULL + [u"c3"]=> + NULL +} +array(3) { + [0]=> + unicode(10) "2002-01-02" + [1]=> + unicode(8) "12:49:00" + [2]=> + NULL +} +array(3) { + [u"c1"]=> + unicode(10) "2002-01-02" + [u"c2"]=> + unicode(8) "12:49:00" + [u"c3"]=> + NULL +} diff --git a/ext/sqlite/tests/sqlite_oo_008.phpt b/ext/sqlite/tests/sqlite_oo_008.phpt index 8e99a1deaf..bdff4fb1b8 100755 --- a/ext/sqlite/tests/sqlite_oo_008.phpt +++ b/ext/sqlite/tests/sqlite_oo_008.phpt @@ -41,3 +41,17 @@ array(1) { string(5) "three" } DONE! +--UEXPECT-- +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_009.phpt b/ext/sqlite/tests/sqlite_oo_009.phpt index c2a55556c1..cbc5f20d83 100755 --- a/ext/sqlite/tests/sqlite_oo_009.phpt +++ b/ext/sqlite/tests/sqlite_oo_009.phpt @@ -41,3 +41,17 @@ array(1) { string(5) "three" } DONE! +--UEXPECT-- +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_010.phpt b/ext/sqlite/tests/sqlite_oo_010.phpt index 8d6f3c0a99..e2eae2a707 100755 --- a/ext/sqlite/tests/sqlite_oo_010.phpt +++ b/ext/sqlite/tests/sqlite_oo_010.phpt @@ -42,3 +42,17 @@ array(1) { string(5) "three" } DONE! +--UEXPECT-- +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_011.phpt b/ext/sqlite/tests/sqlite_oo_011.phpt index 4b5a37044c..53225aa8ce 100755 --- a/ext/sqlite/tests/sqlite_oo_011.phpt +++ b/ext/sqlite/tests/sqlite_oo_011.phpt @@ -31,3 +31,18 @@ array(6) { ["bar.c3"]=> string(1) "6" } +--UEXPECT-- +array(6) { + [u"foo.c1"]=> + unicode(1) "1" + [u"foo.c2"]=> + unicode(1) "2" + [u"foo.c3"]=> + unicode(1) "3" + [u"bar.c1"]=> + unicode(1) "4" + [u"bar.c2"]=> + unicode(1) "5" + [u"bar.c3"]=> + unicode(1) "6" +} diff --git a/ext/sqlite/tests/sqlite_oo_012.phpt b/ext/sqlite/tests/sqlite_oo_012.phpt index 408feb9d17..d6d3a00d0b 100755 --- a/ext/sqlite/tests/sqlite_oo_012.phpt +++ b/ext/sqlite/tests/sqlite_oo_012.phpt @@ -33,3 +33,13 @@ string(3) "foo" string(3) "bar" string(3) "baz" DONE! +--UEXPECT-- +Buffered +unicode(3) "foo" +unicode(3) "bar" +unicode(3) "baz" +Unbuffered +unicode(3) "foo" +unicode(3) "bar" +unicode(3) "baz" +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_013.phpt b/ext/sqlite/tests/sqlite_oo_013.phpt index 0c19505f23..5ecbd2e0c2 100755 --- a/ext/sqlite/tests/sqlite_oo_013.phpt +++ b/ext/sqlite/tests/sqlite_oo_013.phpt @@ -73,3 +73,35 @@ string(4) "four" NULL NULL DONE! +--UEXPECT-- +====BUFFERED==== +array(2) { + [0]=> + unicode(3) "one" + [1]=> + unicode(3) "two" +} +unicode(3) "one" +unicode(3) "two" +unicode(3) "one" +unicode(3) "two" +array(2) { + [0]=> + unicode(5) "three" + [1]=> + unicode(4) "four" +} +unicode(5) "three" +unicode(4) "four" +unicode(5) "three" +unicode(4) "four" +====UNBUFFERED==== +unicode(3) "one" +unicode(3) "two" +NULL +NULL +unicode(5) "three" +unicode(4) "four" +NULL +NULL +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_014.phpt b/ext/sqlite/tests/sqlite_oo_014.phpt index 9735a5442c..a1a200dd8b 100755 --- a/ext/sqlite/tests/sqlite_oo_014.phpt +++ b/ext/sqlite/tests/sqlite_oo_014.phpt @@ -116,3 +116,80 @@ array(3) { } } DONE! +--UEXPECTF-- +unbuffered twice +array(3) { + [0]=> + array(1) { + [0]=> + unicode(3) "one" + } + [1]=> + array(1) { + [0]=> + unicode(3) "two" + } + [2]=> + array(1) { + [0]=> + unicode(5) "three" + } +} + +Warning: SQLiteUnbuffered::fetchAll(): One or more rowsets were already returned; returning NULL this time in %ssqlite_oo_014.php on line %d +array(0) { +} +unbuffered with fetch_array +array(1) { + [0]=> + unicode(3) "one" +} +array(2) { + [0]=> + array(1) { + [0]=> + unicode(3) "two" + } + [1]=> + array(1) { + [0]=> + unicode(5) "three" + } +} +buffered +array(3) { + [0]=> + array(1) { + [0]=> + unicode(3) "one" + } + [1]=> + array(1) { + [0]=> + unicode(3) "two" + } + [2]=> + array(1) { + [0]=> + unicode(5) "three" + } +} +bool(false) +array(3) { + [0]=> + array(1) { + [0]=> + unicode(3) "one" + } + [1]=> + array(1) { + [0]=> + unicode(3) "two" + } + [2]=> + array(1) { + [0]=> + unicode(5) "three" + } +} +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_015.phpt b/ext/sqlite/tests/sqlite_oo_015.phpt index 893e6f14ab..4359387860 100755 --- a/ext/sqlite/tests/sqlite_oo_015.phpt +++ b/ext/sqlite/tests/sqlite_oo_015.phpt @@ -45,3 +45,22 @@ array(3) { } } DONE! +--UEXPECTF-- +array(3) { + [0]=> + array(1) { + [0]=> + unicode(3) "one" + } + [1]=> + array(1) { + [0]=> + unicode(3) "two" + } + [2]=> + array(1) { + [0]=> + unicode(5) "three" + } +} +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_016.phpt b/ext/sqlite/tests/sqlite_oo_016.phpt index d831b48326..bad1b65be0 100755 --- a/ext/sqlite/tests/sqlite_oo_016.phpt +++ b/ext/sqlite/tests/sqlite_oo_016.phpt @@ -40,3 +40,11 @@ string(5) "three" string(3) "one" string(5) "three" DONE! +--UEXPECT-- +====BUFFERED==== +unicode(3) "one" +unicode(5) "three" +====UNBUFFERED==== +unicode(3) "one" +unicode(5) "three" +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_020.phpt b/ext/sqlite/tests/sqlite_oo_020.phpt index a855101fbd..344caccafa 100755 --- a/ext/sqlite/tests/sqlite_oo_020.phpt +++ b/ext/sqlite/tests/sqlite_oo_020.phpt @@ -64,3 +64,19 @@ array(2) { string(4) "four" } DONE! +--UEXPECTF-- +Message: sqlite_factory() expects at least 1 parameter, 0 given +File: %ssqlite_oo_020.php +array(2) { + [0]=> + unicode(3) "one" + [1]=> + unicode(3) "two" +} +array(2) { + [0]=> + unicode(5) "three" + [1]=> + unicode(4) "four" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_021.phpt b/ext/sqlite/tests/sqlite_oo_021.phpt index 850e4dc9a3..34986cfdf7 100755 --- a/ext/sqlite/tests/sqlite_oo_021.phpt +++ b/ext/sqlite/tests/sqlite_oo_021.phpt @@ -46,3 +46,26 @@ array(1) { string(1) "5" } DONE! +--UEXPECTF-- +unicode(1) "5" +unicode(1) "4" +unicode(5) "5data" +array(4) { + [0]=> + unicode(1) "1" + [1]=> + unicode(1) "2" + [2]=> + unicode(1) "3" + [3]=> + unicode(1) "4" +} + +Warning: SQLiteDatabase::singleQuery(): no such table: test in %s on line %d +bool(false) +NULL +array(1) { + [0]=> + unicode(1) "5" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_022.phpt b/ext/sqlite/tests/sqlite_oo_022.phpt index 988904f774..902a9a1a4e 100755 --- a/ext/sqlite/tests/sqlite_oo_022.phpt +++ b/ext/sqlite/tests/sqlite_oo_022.phpt @@ -96,3 +96,64 @@ array(1) { string(5) "three" } ====DONE!==== +--UEXPECTF-- +====SEEK:-1==== + +Warning: SQLiteResult::seek(): row -1 out of range in %ssqlite_oo_022.php on line %d +array(1) { + [0]=> + unicode(3) "one" +} +====SEEK:0==== +array(1) { + [0]=> + unicode(3) "one" +} +====SEEK:1==== +array(1) { + [0]=> + unicode(3) "two" +} +====SEEK:2==== +array(1) { + [0]=> + unicode(5) "three" +} +====SEEK:3==== + +Warning: SQLiteResult::seek(): row 3 out of range in %ssqlite_oo_022.php on line %d +array(1) { + [0]=> + unicode(5) "three" +} +====AGAIN==== +====SEEK:-1==== + +Warning: SQLiteResult::seek(): row -1 out of range in %ssqlite_oo_022.php on line %d +array(1) { + [0]=> + unicode(5) "three" +} +====SEEK:0==== +array(1) { + [0]=> + unicode(3) "one" +} +====SEEK:1==== +array(1) { + [0]=> + unicode(3) "two" +} +====SEEK:2==== +array(1) { + [0]=> + unicode(5) "three" +} +====SEEK:3==== + +Warning: SQLiteResult::seek(): row 3 out of range in %ssqlite_oo_022.php on line %d +array(1) { + [0]=> + unicode(5) "three" +} +====DONE!==== diff --git a/ext/sqlite/tests/sqlite_oo_024.phpt b/ext/sqlite/tests/sqlite_oo_024.phpt index f974ad8a8d..ffd8f07b60 100755 --- a/ext/sqlite/tests/sqlite_oo_024.phpt +++ b/ext/sqlite/tests/sqlite_oo_024.phpt @@ -72,3 +72,34 @@ object(stdClass)#%d (1) { string(5) "three" } ====DONE!==== +--UEXPECTF-- +====class24==== +class24::__construct +object(class24)#%d (1) { + [u"a"]=> + unicode(3) "one" +} +class24::__construct +object(class24)#%d (1) { + [u"a"]=> + unicode(3) "two" +} +class24::__construct +object(class24)#%d (1) { + [u"a"]=> + unicode(5) "three" +} +====stdclass==== +object(stdClass)#%d (1) { + [u"a"]=> + unicode(3) "one" +} +object(stdClass)#%d (1) { + [u"a"]=> + unicode(3) "two" +} +object(stdClass)#%d (1) { + [u"a"]=> + unicode(5) "three" +} +====DONE!==== diff --git a/ext/sqlite/tests/sqlite_oo_025.phpt b/ext/sqlite/tests/sqlite_oo_025.phpt index 3cb42d7647..c2dd0029e3 100755 --- a/ext/sqlite/tests/sqlite_oo_025.phpt +++ b/ext/sqlite/tests/sqlite_oo_025.phpt @@ -101,3 +101,57 @@ array(1) { string(5) "three" } DONE! +--UEXPECT-- +====UNBUFFERED==== +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +====NO-MORE==== +====DIRECT==== +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +====BUFFERED==== +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +array(1) { + [0]=> + unicode(3) "one" +} +array(1) { + [0]=> + unicode(3) "two" +} +array(1) { + [0]=> + unicode(5) "three" +} +DONE! diff --git a/ext/sqlite/tests/sqlite_oo_026.phpt b/ext/sqlite/tests/sqlite_oo_026.phpt index 4beacbb888..0385268a67 100755 --- a/ext/sqlite/tests/sqlite_oo_026.phpt +++ b/ext/sqlite/tests/sqlite_oo_026.phpt @@ -54,3 +54,19 @@ bool(true) string(5) "three" bool(true) ===DONE=== +--UEXPECT-- +====FOREACH==== +unicode(3) "one" +unicode(3) "one" +unicode(3) "two" +unicode(3) "two" +unicode(5) "three" +unicode(5) "three" +====FOR==== +unicode(3) "one" +bool(true) +unicode(3) "two" +bool(true) +unicode(5) "three" +bool(true) +===DONE=== diff --git a/ext/sqlite/tests/sqlite_oo_028.phpt b/ext/sqlite/tests/sqlite_oo_028.phpt index fe7f8c6f68..d6ee4b75db 100755 --- a/ext/sqlite/tests/sqlite_oo_028.phpt +++ b/ext/sqlite/tests/sqlite_oo_028.phpt @@ -23,3 +23,14 @@ array(4) { ["d"]=> string(0) "" } +--UEXPECT-- +array(4) { + [u"a"]=> + unicode(0) "" + [u"b"]=> + unicode(7) "INTEGER" + [u"c"]=> + unicode(11) "VARCHAR(10)" + [u"d"]=> + unicode(0) "" +} diff --git a/ext/sqlite/tests/sqlite_oo_030.phpt b/ext/sqlite/tests/sqlite_oo_030.phpt index 2155115974..023fe72b74 100755 --- a/ext/sqlite/tests/sqlite_oo_030.phpt +++ b/ext/sqlite/tests/sqlite_oo_030.phpt @@ -40,3 +40,12 @@ string(1) "1" string(3) "PHP" Fatal error: Call to undefined method foo::bar("php")() in %ssqlite_oo_030.php on line %d +--UEXPECTF-- +NULL +unicode(1) "1" +unicode(3) "PHP" +NULL +unicode(1) "1" +unicode(3) "PHP" + +Fatal error: Call to undefined method foo::bar("php")() in %ssqlite_oo_030.php on line %d