helly           Sat Jan 20 16:19:21 2007 UTC

  Modified files:              
    /php-src/ext/spl    spl_array.c spl_directory.c spl_functions.c 
                        spl_functions.h spl_observer.c 
    /php-src/ext/spl/tests      dit_001.phpt fileobject_003.phpt 
  Log:
  - Mode debug info
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.119&r2=1.120&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.119 php-src/ext/spl/spl_array.c:1.120
--- php-src/ext/spl/spl_array.c:1.119   Sat Jan 20 14:41:04 2007
+++ php-src/ext/spl/spl_array.c Sat Jan 20 16:19:20 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_array.c,v 1.119 2007/01/20 14:41:04 helly Exp $ */
+/* $Id: spl_array.c,v 1.120 2007/01/20 16:19:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -629,8 +629,9 @@
        spl_array_object *intern = 
(spl_array_object*)zend_object_store_get_object(obj TSRMLS_CC);
        HashTable *rv;
        zval *tmp, *storage;
-       int name_len, class_len, prop_len;
-       zstr zname, zclass, zprop;
+       int name_len;
+       zstr zname;
+       zend_class_entry *base;
 
        if (HASH_OF(intern->array) == intern->std.properties) {
                *is_temp = 0;
@@ -646,28 +647,10 @@
                storage = intern->array;
                zval_add_ref(&storage);
        
-               if (Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator) {
-                       zclass.s = "ArrayIterator";
-                       class_len = sizeof("ArrayIterator") - 1;
-               } else {
-                       zclass.s = "ArrayObject";
-                       class_len = sizeof("ArrayObject") - 1;
-               }
-               zprop.s = "storage";
-               prop_len = sizeof("storage") - 1;
-               if (UG(unicode)) {
-                       zclass.u = zend_ascii_to_unicode(zclass.s, class_len + 
1 ZEND_FILE_LINE_CC);
-                       zprop.u = zend_ascii_to_unicode(zprop.s, prop_len + 1 
ZEND_FILE_LINE_CC);
-                       zend_u_mangle_property_name(&zname, &name_len, 
IS_UNICODE, zclass, class_len, zprop, prop_len, 0);
-                       zend_u_symtable_update(rv, IS_UNICODE, zname, 
name_len+1, &storage, sizeof(zval *), NULL);
-                       efree(zname.v);
-                       efree(zclass.v);
-                       efree(zprop.v);
-               } else {
-                       zend_mangle_property_name(&zname.s, &name_len, 
zclass.s, class_len, zprop.s, prop_len, 0);
-                       zend_symtable_update(rv, zname.s, name_len+1, &storage, 
sizeof(zval *), NULL);
-                       efree(zname.v);
-               }
+               base = (Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator) ? 
spl_ce_ArrayIterator : spl_ce_ArrayObject;
+               zname = spl_gen_private_prop_name(base, "storage", 
sizeof("storage")-1, &name_len TSRMLS_CC);
+               zend_u_symtable_update(rv, ZEND_STR_TYPE, zname, name_len+1, 
&storage, sizeof(zval *), NULL);
+               efree(zname.v);
        
                return rv;
        }
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.116&r2=1.117&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.116 
php-src/ext/spl/spl_directory.c:1.117
--- php-src/ext/spl/spl_directory.c:1.116       Fri Jan 19 10:19:50 2007
+++ php-src/ext/spl/spl_directory.c     Sat Jan 20 16:19:20 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_directory.c,v 1.116 2007/01/19 10:19:50 helly Exp $ */
+/* $Id: spl_directory.c,v 1.117 2007/01/20 16:19:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -456,6 +456,57 @@
        return NULL;
 } /* }}} */
 
+static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp 
TSRMLS_DC) /* {{{{ */
+{
+       spl_filesystem_object *intern = 
(spl_filesystem_object*)zend_object_store_get_object(obj TSRMLS_CC);
+       HashTable *rv;
+       zval *tmp, zrv;
+       zstr pnstr;
+       int  pnlen;
+       char stmp[2];
+
+       *is_temp = 1;
+
+       ALLOC_HASHTABLE(rv);
+       ZEND_INIT_SYMTABLE_EX(rv, 
zend_hash_num_elements(intern->std.properties) + 3, 0);
+
+       INIT_PZVAL(&zrv);
+       Z_ARRVAL(zrv) = rv;
+       
+       zend_hash_copy(rv, intern->std.properties, (copy_ctor_func_t) 
zval_add_ref, (void *) &tmp, sizeof(zval *));
+
+       pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, "pathName", 
sizeof("pathName")-1, &pnlen TSRMLS_CC);
+       add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, 
intern->path_type, intern->path, intern->path_len, 1);
+       efree(pnstr.v);
+       if (intern->file_name.v) {
+               pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, 
"fileName", sizeof("fileName")-1, &pnlen TSRMLS_CC);
+               add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, 
intern->file_name_type, intern->file_name, intern->file_name_len, 1);
+               efree(pnstr.v);
+       }
+       if (intern->type == SPL_FS_DIR && intern->u.dir.sub_path.v) {
+               pnstr = 
spl_gen_private_prop_name(spl_ce_RecursiveDirectoryIterator, "subPathName", 
sizeof("subPathName")-1, &pnlen TSRMLS_CC);
+               add_u_assoc_zstrl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, 
intern->u.dir.sub_path_type, intern->u.dir.sub_path, 
intern->u.dir.sub_path_len, 1);
+               efree(pnstr.v);
+       }
+       if (intern->type == SPL_FS_FILE) {
+               pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, 
"openMode", sizeof("openMode")-1, &pnlen TSRMLS_CC);
+               add_u_assoc_stringl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, 
intern->u.file.open_mode, intern->u.file.open_mode_len, 1);
+               efree(pnstr.v);
+               stmp[1] = '\0';
+               stmp[0] = intern->u.file.delimiter;
+               pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, 
"delimiter", sizeof("delimiter")-1, &pnlen TSRMLS_CC);
+               add_u_assoc_stringl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, 
stmp, 1, 1);
+               efree(pnstr.v);
+               stmp[0] = intern->u.file.enclosure;
+               pnstr = spl_gen_private_prop_name(spl_ce_SplFileObject, 
"enclosure", sizeof("enclosure")-1, &pnlen TSRMLS_CC);
+               add_u_assoc_stringl_ex(&zrv, ZEND_STR_TYPE, pnstr, pnlen+1, 
stmp, 1, 1);
+               efree(pnstr.v);
+       }
+
+       return rv;
+}
+/* }}}} */
+
 /* {{{ proto void DirectoryIterator::__construct(string path) U
  Cronstructs a new dir iterator from a path. */
 SPL_METHOD(DirectoryIterator, __construct)
@@ -2233,6 +2284,7 @@
        memcpy(&spl_filesystem_object_handlers, zend_get_std_object_handlers(), 
sizeof(zend_object_handlers));
        spl_filesystem_object_handlers.clone_obj = spl_filesystem_object_clone;
        spl_filesystem_object_handlers.cast_object = spl_filesystem_object_cast;
+       spl_filesystem_object_handlers.get_debug_info = 
spl_filesystem_object_get_debug_info;
 
        REGISTER_SPL_SUB_CLASS_EX(DirectoryIterator, SplFileInfo, 
spl_filesystem_object_new, spl_DirectoryIterator_functions);
        zend_class_implements(spl_ce_DirectoryIterator TSRMLS_CC, 1, 
zend_ce_iterator);
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_functions.c?r1=1.39&r2=1.40&diff_format=u
Index: php-src/ext/spl/spl_functions.c
diff -u php-src/ext/spl/spl_functions.c:1.39 
php-src/ext/spl/spl_functions.c:1.40
--- php-src/ext/spl/spl_functions.c:1.39        Mon Jan  1 09:29:29 2007
+++ php-src/ext/spl/spl_functions.c     Sat Jan 20 16:19:20 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_functions.c,v 1.39 2007/01/01 09:29:29 sebastian Exp $ */
+/* $Id: spl_functions.c,v 1.40 2007/01/20 16:19:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
        #include "config.h"
@@ -144,6 +144,22 @@
 }
 /* }}} */
 
+zstr spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int 
prop_len, int *name_len TSRMLS_DC) /* {{{ */
+{
+       zstr rv;
+       zstr zprop;
+
+       if (UG(unicode)) {
+               zprop.u = zend_ascii_to_unicode(prop_name, prop_len + 1 
ZEND_FILE_LINE_CC);
+               zend_u_mangle_property_name(&rv, name_len, IS_UNICODE, 
ce->name, ce->name_length, zprop, prop_len, 0);
+               efree(zprop.v);
+       } else {
+               zend_mangle_property_name(&rv.s, name_len, ce->name.s, 
ce->name_length, prop_name, prop_len, 0);
+       }
+       return rv;
+}
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_functions.h?r1=1.25&r2=1.26&diff_format=u
Index: php-src/ext/spl/spl_functions.h
diff -u php-src/ext/spl/spl_functions.h:1.25 
php-src/ext/spl/spl_functions.h:1.26
--- php-src/ext/spl/spl_functions.h:1.25        Mon Jan  1 09:29:29 2007
+++ php-src/ext/spl/spl_functions.h     Sat Jan 20 16:19:20 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_functions.h,v 1.25 2007/01/01 09:29:29 sebastian Exp $ */
+/* $Id: spl_functions.h,v 1.26 2007/01/20 16:19:20 helly Exp $ */
 
 #ifndef PHP_FUNCTIONS_H
 #define PHP_FUNCTIONS_H
@@ -88,6 +88,9 @@
        PHP_MALIAS(spl_ ## alias_class, function_name, alias_function, 
arg_info, flags)
 #endif /* PHP_FUNCTIONS_H */
 
+/* caller must efree(return.v) */
+zstr spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int 
prop_len, int *name_len TSRMLS_DC);
+
 /*
  * Local Variables:
  * c-basic-offset: 4
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_observer.c?r1=1.16&r2=1.17&diff_format=u
Index: php-src/ext/spl/spl_observer.c
diff -u php-src/ext/spl/spl_observer.c:1.16 php-src/ext/spl/spl_observer.c:1.17
--- php-src/ext/spl/spl_observer.c:1.16 Fri Jan 19 23:23:08 2007
+++ php-src/ext/spl/spl_observer.c      Sat Jan 20 16:19:20 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_observer.c,v 1.16 2007/01/19 23:23:08 helly Exp $ */
+/* $Id: spl_observer.c,v 1.17 2007/01/20 16:19:20 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -122,9 +122,9 @@
        HashTable *rv, *props;
        HashPosition pos;
        zval *tmp, *storage, **entry;
-       char md5str[33], *name;
+       char md5str[33];
        int name_len;
-       zstr zname, zclass, zprop;
+       zstr zname;
 
        *is_temp = 1;
 
@@ -145,19 +145,9 @@
                zend_hash_move_forward_ex(&intern->storage, &pos);
        }
 
-       if (UG(unicode)) {
-               zclass.u = USTR_MAKE("SplObjectStorage");
-               zprop.u = USTR_MAKE("storage");
-               zend_u_mangle_property_name(&zname, &name_len, IS_UNICODE, 
zclass, sizeof("SplObjectStorage")-1, zprop, sizeof("storage")-1, 0);
-               zend_u_symtable_update(rv, IS_UNICODE, zname, name_len+1, 
&storage, sizeof(zval *), NULL);
-               efree(zname.v);
-               efree(zclass.v);
-               efree(zprop.v);
-       } else {
-               zend_mangle_property_name(&name, &name_len, "SplObjectStorage", 
sizeof("SplObjectStorage")-1, "storage", sizeof("storage")-1, 0);
-               zend_symtable_update(rv, name, name_len+1, &storage, 
sizeof(zval *), NULL);
-               efree(name);
-       }
+       zname = spl_gen_private_prop_name(spl_ce_SplObjectStorage, "storage", 
sizeof("storage")-1, &name_len TSRMLS_CC);
+       zend_u_symtable_update(rv, ZEND_STR_TYPE, zname, name_len+1, &storage, 
sizeof(zval *), NULL);
+       efree(zname.v);
 
        return rv;
 }
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/dit_001.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/spl/tests/dit_001.phpt
diff -u php-src/ext/spl/tests/dit_001.phpt:1.3 
php-src/ext/spl/tests/dit_001.phpt:1.4
--- php-src/ext/spl/tests/dit_001.phpt:1.3      Wed Sep 29 20:09:52 2004
+++ php-src/ext/spl/tests/dit_001.phpt  Sat Jan 20 16:19:20 2007
@@ -12,7 +12,9 @@
 ?>
 ===DONE===
 --EXPECTF--
-object(DirectoryIterator)#%d (0) {
+object(DirectoryIterator)#%d (1) {
+  %s"pathName"%s"SplFileInfo":private]=>
+  %s(1) "."
 }
 bool(false)
 bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_003.phpt?r1=1.5&r2=1.6&diff_format=u
Index: php-src/ext/spl/tests/fileobject_003.phpt
diff -u php-src/ext/spl/tests/fileobject_003.phpt:1.5 
php-src/ext/spl/tests/fileobject_003.phpt:1.6
--- php-src/ext/spl/tests/fileobject_003.phpt:1.5       Wed Jan 17 22:49:39 2007
+++ php-src/ext/spl/tests/fileobject_003.phpt   Sat Jan 20 16:19:20 2007
@@ -45,9 +45,17 @@
 <?php exit(0); ?>
 --EXPECTF--
 ===0===
-object(SplFileInfo)#%d (0) {
-}
-object(SplFileInfo)#%d (0) {
+object(SplFileInfo)#%d (2) {
+  ["pathName":"SplFileInfo":private]=>
+  string(%d) "%s"
+  ["fileName":"SplFileInfo":private]=>
+  string(%d) "%sfileobject_001a.txt"
+}
+object(SplFileInfo)#%d (2) {
+  ["pathName":"SplFileInfo":private]=>
+  string(%d) "%s"
+  ["fileName":"SplFileInfo":private]=>
+  string(%d) "%sfileobject_001a.txt"
 }
 bool(false)
 bool(true)
@@ -63,9 +71,17 @@
 string(19) "fileobject_001a.txt"
 string(%d) "%stests"
 ===1===
-object(SplFileInfo)#%d (0) {
-}
-object(SplFileInfo)#%d (0) {
+object(SplFileInfo)#%d (2) {
+  ["pathName":"SplFileInfo":private]=>
+  string(%d) "%s"
+  ["fileName":"SplFileInfo":private]=>
+  string(%d) "%s"
+}
+object(SplFileInfo)#%d (2) {
+  ["pathName":"SplFileInfo":private]=>
+  string(%d) "%s"
+  ["fileName":"SplFileInfo":private]=>
+  string(%d) "%s"
 }
 bool(false)
 bool(true)
@@ -81,9 +97,17 @@
 string(%d) "%stests"
 string(%d) "%stests"
 ===2===
-object(SplFileInfo)#1 (0) {
-}
-object(SplFileInfo)#2 (0) {
+object(SplFileInfo)#%d (2) {
+  ["pathName":"SplFileInfo":private]=>
+  string(%d) "%s"
+  ["fileName":"SplFileInfo":private]=>
+  string(%d) "%s"
+}
+object(SplFileInfo)#%d (2) {
+  ["pathName":"SplFileInfo":private]=>
+  string(%d) "%s"
+  ["fileName":"SplFileInfo":private]=>
+  string(%d) "%s"
 }
 bool(false)
 bool(true)
@@ -101,9 +125,17 @@
 ===DONE===
 --UEXPECTF--
 ===0===
-object(SplFileInfo)#%d (0) {
-}
-object(SplFileInfo)#%d (0) {
+object(SplFileInfo)#%d (2) {
+  [u"pathName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
+  [u"fileName":u"SplFileInfo":private]=>
+  unicode(%d) "%sfileobject_001a.txt"
+}
+object(SplFileInfo)#%d (2) {
+  [u"pathName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
+  [u"fileName":u"SplFileInfo":private]=>
+  unicode(%d) "%sfileobject_001a.txt"
 }
 bool(false)
 bool(true)
@@ -119,9 +151,17 @@
 unicode(19) "fileobject_001a.txt"
 unicode(%d) "%stests"
 ===1===
-object(SplFileInfo)#%d (0) {
-}
-object(SplFileInfo)#%d (0) {
+object(SplFileInfo)#%d (2) {
+  [u"pathName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
+  [u"fileName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
+}
+object(SplFileInfo)#%d (2) {
+  [u"pathName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
+  [u"fileName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
 }
 bool(false)
 bool(true)
@@ -137,9 +177,17 @@
 unicode(%d) "%stests"
 unicode(%d) "%stests"
 ===2===
-object(SplFileInfo)#1 (0) {
-}
-object(SplFileInfo)#2 (0) {
+object(SplFileInfo)#%d (2) {
+  [u"pathName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
+  [u"fileName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
+}
+object(SplFileInfo)#%d (2) {
+  [u"pathName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
+  [u"fileName":u"SplFileInfo":private]=>
+  unicode(%d) "%s"
 }
 bool(false)
 bool(true)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to