]> granicus.if.org Git - php/commitdiff
- Quick hackto make tests pass
authorMarcus Boerger <helly@php.net>
Wed, 20 Dec 2006 23:30:23 +0000 (23:30 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 20 Dec 2006 23:30:23 +0000 (23:30 +0000)
# There is something missing, ZVAL_TYPED_ASCII_STRING(z, type, char*,flags)
# Or am i overseeinghow that works?

ext/spl/spl_directory.c

index 550e880b0f8971a46c29cfbe5f510aa322deeadc..05a51e8579d6aab5bf5d25d75149c6324c4207c4 100755 (executable)
@@ -1225,16 +1225,28 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type, v
 {
        spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(readobj TSRMLS_CC);
 
-       if (type == IS_STRING) {
-               switch (intern->type) {
-               case SPL_FS_INFO:
-               case SPL_FS_FILE:
+       switch (intern->type) {
+       case SPL_FS_INFO:
+       case SPL_FS_FILE:
+               if (type == IS_STRING) {
                        ZVAL_STRINGL(writeobj, intern->file_name, intern->file_name_len, 1);
                        return SUCCESS;
-               case SPL_FS_DIR:
+               }
+               if (type == IS_UNICODE && UG(unicode)) {
+                       ZVAL_ASCII_STRINGL(writeobj, intern->file_name, intern->file_name_len, 1);
+                       return SUCCESS;
+               }
+               break;
+       case SPL_FS_DIR:
+               if (type == IS_STRING) {
                        ZVAL_STRING(writeobj, intern->u.dir.entry.d_name, 1);
                        return SUCCESS;
                }
+               if (type == IS_UNICODE && UG(unicode)) {
+                       ZVAL_ASCII_STRING(writeobj, intern->u.dir.entry.d_name, 1);
+                       return SUCCESS;
+               }
+               break;
        }
        ZVAL_NULL(writeobj);
        return FAILURE;