]> git.sesse.net Git - xml-template/blobdiff - php5-swig/xml-template.swig
Add most of the remaining php5-swig tests. Most succeed, but not all.
[xml-template] / php5-swig / xml-template.swig
index 5a560cee6883bf4bce903964fe653ee2755a71c5..fa9e7aa81d4bf0fbb6ee4b358c885549657025f7 100644 (file)
@@ -10,9 +10,7 @@ bool is_associative_array(HashTable *ht)
                return true;
        }
        for (unsigned i = 0; i < ht->nNumOfElements; ++i) {
-               char buf[32];
-               sprintf(buf, "%u", i);
-               if (!zend_hash_exists(ht, buf, strlen(buf))) {
+               if (!zend_hash_index_exists(ht, i)) {
                        return true;
                }
        }
@@ -46,7 +44,13 @@ Directive* convert_php_objects_to_directive(zval *obj)
                        }
                        return new Substitute(my_map);
                } else {
-                       printf("ARRAY\n");
+                       std::vector<Directive *> subdirectives;
+                       for (unsigned i = 0; i < ht->nNumOfElements; ++i) {
+                               zval **data;
+                               zend_hash_index_find(ht, i, (void **)&data);
+                               subdirectives.push_back(convert_php_objects_to_directive(*data));
+                       }
+                       return new Clone(subdirectives);
                }
                break;
        }