]> granicus.if.org Git - php/commitdiff
Update __toString() issues
authorMarcus Boerger <helly@php.net>
Thu, 4 Dec 2003 20:56:32 +0000 (20:56 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 4 Dec 2003 20:56:32 +0000 (20:56 +0000)
ext/spl/examples/cachingiterator.inc
ext/spl/spl_directory.c

index 9146ceeaf64a2f77841d79c0e70992813f40ad51..c54f650e7ee26c1c820f6dba5d6ac643b1113f7e 100644 (file)
@@ -24,7 +24,11 @@ class CachingIterator
                if ($this->more = $this->it->hasMore()) {
                        $this->current = $this->it->current();
                        $this->key = $this->it->key();
-                       $this->strvalue = (string)$this->current;
+                       if (is_object($this->current)) {
+                               $this->strvalue = $this->current->__toString();
+                       } else {
+                               $this->strvalue = (string)$this->current;
+                       }
                } else {
                        $this->current = NULL;
                        $this->key = NULL;
index 02839e191f7ee65682a16aaaa2afc2e636c52d9b..ebbbc3c6c828d3234f257cc687958ac6d193d73b 100755 (executable)
@@ -59,7 +59,6 @@ SPL_METHOD(RecursiveDirectoryIterator, next);
 SPL_METHOD(RecursiveDirectoryIterator, key);
 SPL_METHOD(RecursiveDirectoryIterator, hasChildren);
 SPL_METHOD(RecursiveDirectoryIterator, getChildren);
-SPL_METHOD(RecursiveDirectoryIterator, __toString);
 
 
 /* declare method parameters */
@@ -94,7 +93,6 @@ static zend_function_entry spl_ce_dir_tree_class_functions[] = {
        SPL_ME(RecursiveDirectoryIterator, key,           NULL, ZEND_ACC_PUBLIC)
        SPL_ME(RecursiveDirectoryIterator, hasChildren,   NULL, ZEND_ACC_PUBLIC)
        SPL_ME(RecursiveDirectoryIterator, getChildren,   NULL, ZEND_ACC_PUBLIC)
-       SPL_MA(RecursiveDirectoryIterator, __toString, DirectoryIterator, getPathname, NULL, ZEND_ACC_PUBLIC)
        {NULL, NULL, NULL}
 };