From f6a20bad6ed8b332dea1f16a7bf9e8cde5e420b0 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 19 Sep 2005 07:49:13 +0000 Subject: [PATCH] Unicode support --- ext/spl/spl_array.c | 4 ++-- ext/spl/tests/iterator_024.phpt | 18 ++++++++++++++++++ ext/spl/tests/iterator_027.phpt | 28 ++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 952f547346..b954b22569 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -179,7 +179,7 @@ static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, s intern->fptr_offset_del = NULL; } } - intern->ce_get_iterator = spl_ce_ArrayIterator; + intern->ce_get_iterator = U_CLASS_ENTRY(spl_ce_ArrayIterator); zend_hash_internal_pointer_reset_ex(spl_array_get_hash_table(intern, 0 TSRMLS_CC), &intern->pos); return retval; } @@ -870,7 +870,7 @@ SPL_METHOD(Array, getIteratorClass) zval *object = getThis(); spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - RETURN_STRING(intern->ce_get_iterator->name, 1); + RETURN_TEXTL(intern->ce_get_iterator->name, intern->ce_get_iterator->name_length, 1); } /* }}} */ diff --git a/ext/spl/tests/iterator_024.phpt b/ext/spl/tests/iterator_024.phpt index 0c7dea15bc..cecf08e7a3 100755 --- a/ext/spl/tests/iterator_024.phpt +++ b/ext/spl/tests/iterator_024.phpt @@ -47,3 +47,21 @@ string(22) "RecursiveArrayIterator" 331 4 ===DONE=== +--UEXPECT-- +1 +2 +31 +32 +331 +4 +unicode(13) "ArrayIterator" +An instance of RecursiveIterator or IteratorAggregate creating it is required +===MANUAL=== +unicode(22) "RecursiveArrayIterator" +1 +2 +31 +32 +331 +4 +===DONE=== diff --git a/ext/spl/tests/iterator_027.phpt b/ext/spl/tests/iterator_027.phpt index fd9ba70c0f..3c2f722385 100755 --- a/ext/spl/tests/iterator_027.phpt +++ b/ext/spl/tests/iterator_027.phpt @@ -81,3 +81,31 @@ bool(false) bool(false) bool(false) ===DONE=== +--UEXPECT-- +0=>1 +1=>2 +0=>31 +1=>32 +0=>331 +3=>4 +===CHECK=== +int(0) +int(331) +int(1) +int(32) +int(3) +int(4) +unicode(3) "foo" +unicode(3) "bar" +unicode(2) "25" +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +===REWIND=== +bool(true) +bool(false) +bool(false) +bool(false) +===DONE=== -- 2.50.1