implemented get_properties() object handler
authorMichael Wallner <mike@php.net>
Sat, 13 Apr 2013 15:55:44 +0000 (17:55 +0200)
committerMichael Wallner <mike@php.net>
Sat, 13 Apr 2013 15:55:44 +0000 (17:55 +0200)
12 files changed:
package.xml
php_pq.h
src/php_pq_object.c
src/php_pq_object.h
src/php_pqcancel.c
src/php_pqconn.c
src/php_pqcopy.c
src/php_pqlob.c
src/php_pqres.c
src/php_pqstm.c
src/php_pqtxn.c
src/php_pqtypes.c

index 8f2a70141e20fb92aa8f7f87f85724863a821dc8..67dfa0d5ced92228132716f622f71e283c90b475 100644 (file)
@@ -19,9 +19,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <email>mike@php.net</email>
   <active>yes</active>
  </lead>
- <date>2013-03-22</date>
+ <date>2013-04-13</date>
  <version>
-  <release>0.1.0</release>
+  <release>0.2.0dev</release>
   <api>0.1.0</api>
  </version>
  <stability>
@@ -30,7 +30,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
  </stability>
  <license>BSD, revised</license>
  <notes><![CDATA[
-* Initial release
+* Implemented get_properties() object handler.
 ]]></notes>
  <contents>
   <dir name="/">
index 5021711e356bb183192ed9b07f1b83e05d5d4d02..8eb8495ef51711401a0b88bcb4280037cac7a058 100644 (file)
--- a/php_pq.h
+++ b/php_pq.h
@@ -14,7 +14,7 @@
 #ifndef PHP_PQ_H
 #define PHP_PQ_H
 
-#define PHP_PQ_EXT_VERSION "0.1.0"
+#define PHP_PQ_EXT_VERSION "0.2.0dev"
 
 int pq_module_number;
 zend_module_entry pq_module_entry;
index 78db20f2c56d04be1f55d08a3ac1c73965ef197e..704737ff95b1fcc2fcb95fccbed9ea7834ed5155 100644 (file)
@@ -70,7 +70,7 @@ static int apply_pi_to_ht(void *p TSRMLS_DC, int argc, va_list argv, zend_hash_k
        if (addref) {
                Z_ADDREF_P(property);
        }
-       zend_hash_add(ht, pi->name, pi->name_length + 1, (void *) &property, sizeof(zval *), NULL);
+       zend_hash_update(ht, pi->name, pi->name_length + 1, (void *) &property, sizeof(zval *), NULL);
 
        return ZEND_HASH_APPLY_KEEP;
 }
@@ -89,6 +89,16 @@ HashTable *php_pq_object_debug_info(zval *object, int *temp TSRMLS_DC)
        return ht;
 }
 
+HashTable *php_pq_object_properties(zval *object TSRMLS_DC)
+{
+       HashTable *ht = zend_get_std_object_handlers()->get_properties(object TSRMLS_CC);
+       php_pq_object_t *obj = zend_object_store_get_object(object TSRMLS_CC);
+
+       zend_hash_apply_with_arguments(&obj->zo.ce->properties_info TSRMLS_CC, apply_pi_to_ht, 4, ht, object, obj, 1);
+
+       return ht;
+}
+
 zend_class_entry *ancestor(zend_class_entry *ce)
 {
        while (ce->parent) {
index 7bbdd845f0675b42a5eae72ead458de80d4cd026..311f17f3a5525873e57b376655b739a84f45acdd 100644 (file)
@@ -32,6 +32,7 @@ void php_pq_object_to_zval_no_addref(void *o, zval **zv TSRMLS_DC);
 void php_pq_object_addref(void *o TSRMLS_DC);
 void php_pq_object_delref(void *o TSRMLS_DC);
 HashTable *php_pq_object_debug_info(zval *object, int *temp TSRMLS_DC);
+HashTable *php_pq_object_properties(zval *object TSRMLS_DC);
 zend_class_entry *ancestor(zend_class_entry *ce);
 zval *php_pq_object_read_prop(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC);
 void php_pq_object_write_prop(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC);
index 326cbcd3ecab97d8732dcd2f384fc78ff6a9571e..8f3d9daae6ad468211edab432fd3ad20c7c729ff 100644 (file)
@@ -158,6 +158,7 @@ PHP_MINIT_FUNCTION(pqcancel)
        php_pqcancel_object_handlers.write_property = php_pq_object_write_prop;
        php_pqcancel_object_handlers.clone_obj = NULL;
        php_pqcancel_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqcancel_object_handlers.get_properties = php_pq_object_properties;
        php_pqcancel_object_handlers.get_debug_info = php_pq_object_debug_info;
 
        zend_hash_init(&php_pqcancel_object_prophandlers, 1, NULL, NULL, 1);
index e71199d59e3fb133e22e61a313e8b1032fe04a31..5031426561dafd6f2da433575565ca9d42e713a8 100644 (file)
@@ -1502,6 +1502,7 @@ PHP_MINIT_FUNCTION(pqconn)
        php_pqconn_object_handlers.write_property = php_pq_object_write_prop;
        php_pqconn_object_handlers.clone_obj = NULL;
        php_pqconn_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqconn_object_handlers.get_properties = php_pq_object_properties;
        php_pqconn_object_handlers.get_debug_info = php_pq_object_debug_info;
 
        zend_hash_init(&php_pqconn_object_prophandlers, 14, NULL, NULL, 1);
index 89ab68c5037bab7207c37778a4cf93251c6872ab..1ea8a50618919990ac0bf2603c2f2ede6c554581 100644 (file)
@@ -322,6 +322,7 @@ PHP_MINIT_FUNCTION(pqcopy)
        php_pqcopy_object_handlers.write_property = php_pq_object_write_prop;
        php_pqcopy_object_handlers.clone_obj = NULL;
        php_pqcopy_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqcopy_object_handlers.get_properties = php_pq_object_properties;
        php_pqcopy_object_handlers.get_debug_info = php_pq_object_debug_info;
 
        zend_hash_init(&php_pqcopy_object_prophandlers, 4, NULL, NULL, 1);
index 9f3717d6c91940455eb75dc1c86b26269d5575c8..2dc9be3d28004529cca0d35db95b5eb265bb766b 100644 (file)
@@ -463,6 +463,7 @@ PHP_MINIT_FUNCTION(pqlob)
        php_pqlob_object_handlers.write_property = php_pq_object_write_prop;
        php_pqlob_object_handlers.clone_obj = NULL;
        php_pqlob_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqlob_object_handlers.get_properties = php_pq_object_properties;
        php_pqlob_object_handlers.get_debug_info = php_pq_object_debug_info;
 
        zend_hash_init(&php_pqlob_object_prophandlers, 3, NULL, NULL, 1);
index a1e1d0022eb63d2393f6c6ad6dcfc6cd8bc2f6a7..57818f4685badfaa95e2fd98c22376e6b23342b5 100644 (file)
@@ -880,6 +880,7 @@ PHP_MINIT_FUNCTION(pqres)
        php_pqres_object_handlers.clone_obj = NULL;
        php_pqres_object_handlers.get_property_ptr_ptr = NULL;
        php_pqres_object_handlers.get_debug_info = php_pq_object_debug_info;
+       php_pqres_object_handlers.get_properties = php_pq_object_properties;
        php_pqres_object_handlers.count_elements = php_pqres_count_elements;
 
        zend_hash_init(&php_pqres_object_prophandlers, 6, NULL, NULL, 1);
index 016b5b7e6b07428907804548664a67d6d67d03ed..83496df4f8b75d1ad2b1719e3ff6200cd9658537 100644 (file)
@@ -359,6 +359,7 @@ PHP_MINIT_FUNCTION(pqstm)
        php_pqstm_object_handlers.write_property = php_pq_object_write_prop;
        php_pqstm_object_handlers.clone_obj = NULL;
        php_pqstm_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqstm_object_handlers.get_properties = php_pq_object_properties;
        php_pqstm_object_handlers.get_debug_info = php_pq_object_debug_info;
 
        zend_hash_init(&php_pqstm_object_prophandlers, 2, NULL, NULL, 1);
index 5c2695f61d1ab24335c6d1a2626362af96cb5b1f..411b7fbc587905fc70335efa26cf3ede176cdc42 100644 (file)
@@ -886,6 +886,7 @@ PHP_MINIT_FUNCTION(pqtxn)
        php_pqtxn_object_handlers.write_property = php_pq_object_write_prop;
        php_pqtxn_object_handlers.clone_obj = NULL;
        php_pqtxn_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqtxn_object_handlers.get_properties = php_pq_object_properties;
        php_pqtxn_object_handlers.get_debug_info = php_pq_object_debug_info;
 
        zend_hash_init(&php_pqtxn_object_prophandlers, 4, NULL, NULL, 1);
index fc9a16e19a4ec8cc6451104e90a8c1b1f7950c63..8995f26a71a5147d5fab0b55f9071b0974befc1b 100644 (file)
@@ -324,6 +324,7 @@ PHP_MINIT_FUNCTION(pqtypes)
        php_pqtypes_object_handlers.write_property = php_pq_object_write_prop;
        php_pqtypes_object_handlers.clone_obj = NULL;
        php_pqtypes_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqtypes_object_handlers.get_properties = php_pq_object_properties;
        php_pqtypes_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqtypes_object_handlers.has_dimension = php_pqtypes_object_has_dimension;
        php_pqtypes_object_handlers.read_dimension = php_pqtypes_object_read_dimension;