]> granicus.if.org Git - php/commitdiff
Unicode support
authorDmitry Stogov <dmitry@php.net>
Tue, 16 Aug 2005 15:09:51 +0000 (15:09 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 16 Aug 2005 15:09:51 +0000 (15:09 +0000)
50 files changed:
ext/dom/tests/bug28817.phpt
ext/simplexml/simplexml.c
ext/simplexml/tests/008.phpt
ext/simplexml/tests/009.phpt
ext/simplexml/tests/015.phpt
ext/simplexml/tests/022.phpt
ext/spl/spl_sxe.c
ext/spl/tests/sxe_002.phpt
ext/spl/tests/sxe_003.phpt
ext/spl/tests/sxe_004.phpt
ext/sqlite/sqlite.c
ext/sqlite/tests/sqlite_002.phpt
ext/sqlite/tests/sqlite_003.phpt
ext/sqlite/tests/sqlite_005.phpt
ext/sqlite/tests/sqlite_006.phpt
ext/sqlite/tests/sqlite_007.phpt
ext/sqlite/tests/sqlite_008.phpt
ext/sqlite/tests/sqlite_009.phpt
ext/sqlite/tests/sqlite_010.phpt
ext/sqlite/tests/sqlite_011.phpt
ext/sqlite/tests/sqlite_012.phpt
ext/sqlite/tests/sqlite_013.phpt
ext/sqlite/tests/sqlite_014.phpt
ext/sqlite/tests/sqlite_015.phpt
ext/sqlite/tests/sqlite_016.phpt
ext/sqlite/tests/sqlite_019.phpt
ext/sqlite/tests/sqlite_022.phpt
ext/sqlite/tests/sqlite_023.phpt
ext/sqlite/tests/sqlite_024.phpt
ext/sqlite/tests/sqlite_025.phpt
ext/sqlite/tests/sqlite_026.phpt
ext/sqlite/tests/sqlite_oo_002.phpt
ext/sqlite/tests/sqlite_oo_003.phpt
ext/sqlite/tests/sqlite_oo_008.phpt
ext/sqlite/tests/sqlite_oo_009.phpt
ext/sqlite/tests/sqlite_oo_010.phpt
ext/sqlite/tests/sqlite_oo_011.phpt
ext/sqlite/tests/sqlite_oo_012.phpt
ext/sqlite/tests/sqlite_oo_013.phpt
ext/sqlite/tests/sqlite_oo_014.phpt
ext/sqlite/tests/sqlite_oo_015.phpt
ext/sqlite/tests/sqlite_oo_016.phpt
ext/sqlite/tests/sqlite_oo_020.phpt
ext/sqlite/tests/sqlite_oo_021.phpt
ext/sqlite/tests/sqlite_oo_022.phpt
ext/sqlite/tests/sqlite_oo_024.phpt
ext/sqlite/tests/sqlite_oo_025.phpt
ext/sqlite/tests/sqlite_oo_026.phpt
ext/sqlite/tests/sqlite_oo_028.phpt
ext/sqlite/tests/sqlite_oo_030.phpt

index 26dd283c560f812e131b1ff4a519cd4eaa2d6637..1d04ff3f1cad78e565bc5fab94ac3c9df796e1e8 100644 (file)
@@ -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"
index ba6859f8511325de8fb15f0fdbaf1675bf7a4c72..b4f18efdb1e9217b70f1876d399c6ed0d8ea1bd7 100644 (file)
@@ -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)
index 3554b32040463123b2c19e6b57c1f9c651855f3f..76b6ec8fe8d8c1d4f7e1da5c1444b754620e7e9c 100644 (file)
@@ -37,3 +37,13 @@ array(1) {
   }
 }
 bool(false)
+--UEXPECTF--
+array(1) {
+  [0]=>
+  object(SimpleXMLElement)#%d (1) {
+    [u"test"]=>
+    object(SimpleXMLElement)#%d (0) {
+    }
+  }
+}
+bool(false)
index a5502ac4aa06bfc27c5ecc9989b508afcc338f97..83f4629ce4883b4c82ad91568404b394c121a9f6 100755 (executable)
@@ -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===
index 11e9cd55cda2ad1eda0fcd7a9722a42936f0d149..aa827d72d8a13f037d5820771249fc34d7fe9b70 100644 (file)
@@ -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===
index 08cb908c9c0aa2d07b5f47dc6ebd8c412db89538..4a646205d5a233c67ea80a3eecf795625b4c2fa4 100755 (executable)
@@ -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===
index 5880bfb0bf8c1f8f955c1d84a6bd5252cc1ace01..aedad3dc43cc61962da912238276a9f1f437ea6e 100755 (executable)
@@ -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;
index ea9edd39f77470077ceb20aa68ef9bd6ea40a17a..4734625fcdf1723957fe257d1c698d2bef9c2911 100755 (executable)
@@ -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===
index e222af6eb911650768359fe71f7365f5c03abd9d..0d09b4ea6e3abb889bbad91b658e833733d6751b 100755 (executable)
@@ -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===
index 98865955ad0271dc3e6462bcbb768afc37e661f8..3ef99514fef7cc71b05e39d863ee1757d46b147b 100755 (executable)
@@ -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===
index dea30603ded1fb20c005c19ce0e816c133fb178a..2395d9909cf789c0d215638a9e8b454c756c2771 100644 (file)
@@ -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();
        }
index c9fd0e1bca4babb25e30ee173febed52c7ae52ed..325d79865346ba325621a905e87b3de412e79ec6 100755 (executable)
@@ -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
+}
index adb891b726d06cca04a989f615d4f17a989f4f59..42696384703abb530587c4c9ccf8a3f8cb63ccb4 100755 (executable)
@@ -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
+}
index e0eeab5589b309560146641eda4fa0185236eae1..4acdebddf408627aaffda12351582200db3199f1 100644 (file)
@@ -48,3 +48,9 @@ array(1) {
   string(11) "onetwothree"
 }
 DONE!
+--UEXPECT--
+array(1) {
+  [0]=>
+  unicode(11) "onetwothree"
+}
+DONE!
index 4e6e5f19ed6112f293fefa0392085ba0bb78a5e4..409d7e49c0e538974b8d99d31a40095ca4cbb1a7 100644 (file)
@@ -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!
index 5a1e536188bc6f2769548828df90eec91faf5412..5635e9e79301a299c53a0579ad1594893b3f60ca 100755 (executable)
@@ -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
+}
index ee485c76a1b1f32d90dd657e0d979bca51c52e20..5e5950b34e1187f68137760b1bf8747b922da0b3 100755 (executable)
@@ -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!
index bdad770b572841fb3b2781c91a49a8ee1a097c2e..de45b03be9bdffed184fc62686062e97093ccf8d 100755 (executable)
@@ -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!
index 152fde4cf004433149959941632171ae88cbed5a..f13d95ffd993d46107d1893677774c777a3a17cc 100755 (executable)
@@ -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!
index 9c1bf3990f8a784aad86d5140f2954f318aa9e91..e24d1d8639474a85318d3563bd1e4cd5e210fdf5 100755 (executable)
@@ -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"
+}
index 14d9ea4f534d546841b9af8817cdee061b179134..b8b89e558e0d47f695dc28e7bbdeacab9761c5e2 100755 (executable)
@@ -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!
index 95b047a75cac28757f4b47764db256f3d3b34281..4ed0e7856a3b1d521523ae07c86f33c107c1b63e 100755 (executable)
@@ -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!
index 967fcc10fab99187cb09fdb3964c09da7264dc5e..6ecad25e49324b0082d8c072ba1f6f84f566f37a 100755 (executable)
@@ -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!
index 8de42a84b9a4be558e763add0d6364d4f9a47ff0..e78e02cf7ad747b993e08ee147d5d2cdc782da28 100755 (executable)
@@ -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!
index 9ca9de135fc9e0843a29ce2750851efdbb77ffc2..30c2ca7d6dfca923e4e6f1cd85dd1d4b5b2fca56 100755 (executable)
@@ -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!
index 74dcff99fa4e8e060dc29438b7c8d14339ba7cab..f03dac85b2d06c4e15f1499de9542d26ba3dd05a 100755 (executable)
@@ -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"
+}
index 76921d56f6bcc74334fae81f3a878cfb3f493eae..492edbceee7f6d58ebf536e530634b999ca1ff6c 100755 (executable)
@@ -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!====
index fbb8dc8da8f60ae06fe8c30257eef8f2e7d4d86e..b36eed18158d6f2e1df0b88458811959bb2b8f50 100644 (file)
@@ -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!====
index b7198c015599518049595d1160a5a0ffde78c737..0912217737db33c04467661344797e54f8f7b8d1 100755 (executable)
@@ -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!====
index 0a257610cc2bf437268420415100eb25818b201f..a9b7829eea6dc3d530589ce5a4d2320fe6b3ea4d 100755 (executable)
@@ -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"
+}
index c508979a27977ae5e09ebb58401e1582ea2b13e5..5b5c3504ec89a5a26ddf2e3d8959a297c3bf3e68 100755 (executable)
@@ -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) ""
+}
index 00a568a2a882d0c9b6065a1fc85800351910c479..6ab999654994d7f0223d93869c7752d4d76d70d9 100755 (executable)
@@ -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
+}
index f9ca65c6112c80af0ca72e13d25252cafc9c7fd5..00d646594573dcc0056a69666ddf4cfb2145e032 100755 (executable)
@@ -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
+}
index 8e99a1deaf3fbea235340f8f396919cc691bba12..bdff4fb1b8c521b873bcfc1a55f77beae604d15e 100755 (executable)
@@ -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!
index c2a55556c1ba3a25cb66364afe1169823e7d5057..cbc5f20d837b7c72091efbabaa4c297e205df954 100755 (executable)
@@ -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!
index 8d6f3c0a99279e9485f29020b02abd28fe29a4ee..e2eae2a707f0bccdd6c2f6c0ebaf7da8d9837812 100755 (executable)
@@ -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!
index 4b5a37044c100cd4ef5c4f5d23542aababf095a9..53225aa8cee4f0169ed9cd634f3d11757440135d 100755 (executable)
@@ -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"
+}
index 408feb9d174b8bfd79014173fbd16362823201d8..d6d3a00d0b570c3b1c04d73a974154d64aaba798 100755 (executable)
@@ -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!
index 0c19505f2330abc1e8108926938d5850430bd7b0..5ecbd2e0c2d9923bb9b294c701c534628f53eb3d 100755 (executable)
@@ -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!
index 9735a5442c922ffb0cb012fcf7ef160ac767d632..a1a200dd8bd5f9c3cf368a6714ae68ce36004676 100755 (executable)
@@ -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!
index 893e6f14abfaa49e421cfccca59972aa7774f2af..4359387860be838bd81a5e2363c5efcd0bd94086 100755 (executable)
@@ -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!
index d831b48326de6059200f174234ec5f1938d9c7e5..bad1b65be0967ddd00c0b9c2b7548ccad83ec0a1 100755 (executable)
@@ -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!
index a855101fbde43b8e82e61244581029dd70c59c43..344caccafaadc113772a5975b4a25209d86dbd95 100755 (executable)
@@ -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!
index 850e4dc9a3afa43d1afb72e6e8747c4877d93b6d..34986cfdf70a278bc3e460a9451eace5d5cf1fb0 100755 (executable)
@@ -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!
index 988904f774f98499ef2bc5a3b4e3a5904d4f40c0..902a9a1a4ed28951197e7c8d0b9a52be42a30528 100755 (executable)
@@ -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!====
index f974ad8a8d072c097b29ac2246782f97b39d264e..ffd8f07b609f7df8aaca347329ccf0d09450f3ab 100755 (executable)
@@ -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!====
index 3cb42d764746bbb60014191d33a13677e9dbbd93..c2dd0029e3a32879f636780b3260f456f488301a 100755 (executable)
@@ -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!
index 4beacbb8880425eeff68967ffe37d13948a65332..0385268a6706ea3fe1ffa250c744169e0e406952 100755 (executable)
@@ -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===
index fe7f8c6f681b0cea86f1cd4cce14b1a3529f7680..d6ee4b75dbb1308d84912b994da4be2776ca62d1 100755 (executable)
@@ -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) ""
+}
index 2155115974d78ff5ea9fab864273a6fb35632a8b..023fe72b748145c6f1d9332490525890afee41fb 100755 (executable)
@@ -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