PHP-7.4 compat
authorMichael Wallner <mike@php.net>
Sat, 2 Mar 2019 17:37:26 +0000 (18:37 +0100)
committerMichael Wallner <mike@php.net>
Mon, 4 Mar 2019 06:50:43 +0000 (07:50 +0100)
src/php_pq_object.c
src/php_pq_object.h
src/php_pqcancel.c
src/php_pqconn.c
src/php_pqcopy.c
src/php_pqcur.c
src/php_pqlob.c
src/php_pqres.c
src/php_pqstm.c
src/php_pqtxn.c
src/php_pqtypes.c

index 7c695ff..b9ce32d 100644 (file)
@@ -203,7 +203,7 @@ zval *php_pq_object_read_prop(zval *object, zval *member, int type, void **cache
        return return_value;
 }
 
        return return_value;
 }
 
-void php_pq_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot)
+php_pq_object_write_prop_t php_pq_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot)
 {
        php_pq_object_t *obj = PHP_PQ_OBJ(object, NULL);
        php_pq_object_prophandler_t *handler;
 {
        php_pq_object_t *obj = PHP_PQ_OBJ(object, NULL);
        php_pq_object_prophandler_t *handler;
@@ -218,6 +218,14 @@ void php_pq_object_write_prop(zval *object, zval *member, zval *value, void **ca
        } else {
                zend_get_std_object_handlers()->write_property(object, member, value, cache_slot);
        }
        } else {
                zend_get_std_object_handlers()->write_property(object, member, value, cache_slot);
        }
+#if PHP_VERSION_ID >= 70400
+       return value;
+#endif
+}
+
+zval *php_pq_object_get_prop_ptr_null(zval *object, zval *member, int type, void **cache_slot)
+{
+       return NULL;
 }
 
 void php_pq_object_prophandler_dtor(zval *zv) {
 }
 
 void php_pq_object_prophandler_dtor(zval *zv) {
index 2c7417a..a274dd4 100644 (file)
@@ -49,7 +49,13 @@ extern HashTable *php_pq_object_properties(zval *object);
 HashTable *php_pq_object_get_gc(zval *object, zval **table, int *n);
 extern zend_class_entry *ancestor(zend_class_entry *ce);
 extern zval *php_pq_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp);
 HashTable *php_pq_object_get_gc(zval *object, zval **table, int *n);
 extern zend_class_entry *ancestor(zend_class_entry *ce);
 extern zval *php_pq_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp);
-extern void php_pq_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
+#if PHP_VERSION_ID >= 70400
+typedef zval *php_pq_object_write_prop_t;
+#else
+typedef void php_pq_object_write_prop_t;
+#endif
+extern php_pq_object_write_prop_t php_pq_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
+extern zval *php_pq_object_get_prop_ptr_null(zval *object, zval *member, int type, void **cache_slot);
 extern void php_pq_object_prophandler_dtor(zval *zv);
 
 #endif
 extern void php_pq_object_prophandler_dtor(zval *zv);
 
 #endif
index edf8b10..e3b6ed7 100644 (file)
@@ -156,7 +156,7 @@ PHP_MINIT_FUNCTION(pqcancel)
        php_pqcancel_object_handlers.read_property = php_pq_object_read_prop;
        php_pqcancel_object_handlers.write_property = php_pq_object_write_prop;
        php_pqcancel_object_handlers.clone_obj = NULL;
        php_pqcancel_object_handlers.read_property = php_pq_object_read_prop;
        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_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqcancel_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqcancel_object_handlers.get_properties = php_pq_object_properties;
        php_pqcancel_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqcancel_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqcancel_object_handlers.get_properties = php_pq_object_properties;
        php_pqcancel_object_handlers.get_debug_info = php_pq_object_debug_info;
index 9b507b6..e3ca68f 100644 (file)
@@ -2004,7 +2004,7 @@ PHP_MINIT_FUNCTION(pqconn)
        php_pqconn_object_handlers.read_property = php_pq_object_read_prop;
        php_pqconn_object_handlers.write_property = php_pq_object_write_prop;
        php_pqconn_object_handlers.clone_obj = NULL;
        php_pqconn_object_handlers.read_property = php_pq_object_read_prop;
        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_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqconn_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqconn_object_handlers.get_properties = php_pq_object_properties;
        php_pqconn_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqconn_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqconn_object_handlers.get_properties = php_pq_object_properties;
        php_pqconn_object_handlers.get_debug_info = php_pq_object_debug_info;
index e945679..1ab3ad9 100644 (file)
@@ -321,7 +321,7 @@ PHP_MINIT_FUNCTION(pqcopy)
        php_pqcopy_object_handlers.read_property = php_pq_object_read_prop;
        php_pqcopy_object_handlers.write_property = php_pq_object_write_prop;
        php_pqcopy_object_handlers.clone_obj = NULL;
        php_pqcopy_object_handlers.read_property = php_pq_object_read_prop;
        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_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqcopy_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqcopy_object_handlers.get_properties = php_pq_object_properties;
        php_pqcopy_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqcopy_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqcopy_object_handlers.get_properties = php_pq_object_properties;
        php_pqcopy_object_handlers.get_debug_info = php_pq_object_debug_info;
index 9989533..6dcd83e 100644 (file)
@@ -433,7 +433,7 @@ PHP_MINIT_FUNCTION(pqcur)
        php_pqcur_object_handlers.read_property = php_pq_object_read_prop;
        php_pqcur_object_handlers.write_property = php_pq_object_write_prop;
        php_pqcur_object_handlers.clone_obj = NULL;
        php_pqcur_object_handlers.read_property = php_pq_object_read_prop;
        php_pqcur_object_handlers.write_property = php_pq_object_write_prop;
        php_pqcur_object_handlers.clone_obj = NULL;
-       php_pqcur_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqcur_object_handlers.get_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqcur_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqcur_object_handlers.get_properties = php_pq_object_properties;
        php_pqcur_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqcur_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqcur_object_handlers.get_properties = php_pq_object_properties;
        php_pqcur_object_handlers.get_debug_info = php_pq_object_debug_info;
index 5d1f6ba..006eb75 100644 (file)
@@ -453,7 +453,7 @@ PHP_MINIT_FUNCTION(pqlob)
        php_pqlob_object_handlers.read_property = php_pq_object_read_prop;
        php_pqlob_object_handlers.write_property = php_pq_object_write_prop;
        php_pqlob_object_handlers.clone_obj = NULL;
        php_pqlob_object_handlers.read_property = php_pq_object_read_prop;
        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_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqlob_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqlob_object_handlers.get_properties = php_pq_object_properties;
        php_pqlob_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqlob_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqlob_object_handlers.get_properties = php_pq_object_properties;
        php_pqlob_object_handlers.get_debug_info = php_pq_object_debug_info;
index 7638445..6e8bb07 100644 (file)
@@ -1192,7 +1192,7 @@ PHP_MINIT_FUNCTION(pqres)
        php_pqres_object_handlers.read_property = php_pq_object_read_prop;
        php_pqres_object_handlers.write_property = php_pq_object_write_prop;
        php_pqres_object_handlers.clone_obj = NULL;
        php_pqres_object_handlers.read_property = php_pq_object_read_prop;
        php_pqres_object_handlers.write_property = php_pq_object_write_prop;
        php_pqres_object_handlers.clone_obj = NULL;
-       php_pqres_object_handlers.get_property_ptr_ptr = NULL;
+       php_pqres_object_handlers.get_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqres_object_handlers.get_gc = php_pq_object_get_gc;
        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.get_gc = php_pq_object_get_gc;
        php_pqres_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqres_object_handlers.get_properties = php_pq_object_properties;
index a5caa1b..60f4bc8 100644 (file)
@@ -493,7 +493,7 @@ PHP_MINIT_FUNCTION(pqstm)
        php_pqstm_object_handlers.read_property = php_pq_object_read_prop;
        php_pqstm_object_handlers.write_property = php_pq_object_write_prop;
        php_pqstm_object_handlers.clone_obj = NULL;
        php_pqstm_object_handlers.read_property = php_pq_object_read_prop;
        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_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqstm_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqstm_object_handlers.get_properties = php_pq_object_properties;
        php_pqstm_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqstm_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqstm_object_handlers.get_properties = php_pq_object_properties;
        php_pqstm_object_handlers.get_debug_info = php_pq_object_debug_info;
index 70b7ec9..ebcb44d 100644 (file)
@@ -883,7 +883,7 @@ PHP_MINIT_FUNCTION(pqtxn)
        php_pqtxn_object_handlers.read_property = php_pq_object_read_prop;
        php_pqtxn_object_handlers.write_property = php_pq_object_write_prop;
        php_pqtxn_object_handlers.clone_obj = NULL;
        php_pqtxn_object_handlers.read_property = php_pq_object_read_prop;
        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_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqtxn_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqtxn_object_handlers.get_properties = php_pq_object_properties;
        php_pqtxn_object_handlers.get_debug_info = php_pq_object_debug_info;
        php_pqtxn_object_handlers.get_gc = php_pq_object_get_gc;
        php_pqtxn_object_handlers.get_properties = php_pq_object_properties;
        php_pqtxn_object_handlers.get_debug_info = php_pq_object_debug_info;
index e1d22ad..323883c 100644 (file)
@@ -143,6 +143,16 @@ static zval *php_pqtypes_object_read_dimension(zval *object, zval *member, int t
        return data;
 }
 
        return data;
 }
 
+static void php_pqtypes_object_write_dimension(zval *object, zval *offset, zval *value)
+{
+       throw_exce(EX_RUNTIME, "pq\\Types object must not be modified");
+}
+
+static void php_pqtypes_object_unset_dimension(zval *object, zval *offset)
+{
+       throw_exce(EX_RUNTIME, "pq\\Types object must not be modified");
+}
+
 ZEND_BEGIN_ARG_INFO_EX(ai_pqtypes_construct, 0, 0, 1)
        ZEND_ARG_OBJ_INFO(0, connection, pq\\Connection, 0)
        ZEND_ARG_ARRAY_INFO(0, namespaces, 1)
 ZEND_BEGIN_ARG_INFO_EX(ai_pqtypes_construct, 0, 0, 1)
        ZEND_ARG_OBJ_INFO(0, connection, pq\\Connection, 0)
        ZEND_ARG_ARRAY_INFO(0, namespaces, 1)
@@ -301,14 +311,14 @@ PHP_MINIT_FUNCTION(pqtypes)
        php_pqtypes_object_handlers.read_property = php_pq_object_read_prop;
        php_pqtypes_object_handlers.write_property = php_pq_object_write_prop;
        php_pqtypes_object_handlers.clone_obj = NULL;
        php_pqtypes_object_handlers.read_property = php_pq_object_read_prop;
        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_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
        php_pqtypes_object_handlers.get_gc = php_pq_object_get_gc;
        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;
        php_pqtypes_object_handlers.get_gc = php_pq_object_get_gc;
        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;
-       php_pqtypes_object_handlers.unset_dimension = NULL;
-       php_pqtypes_object_handlers.write_dimension = NULL;
+       php_pqtypes_object_handlers.unset_dimension = php_pqtypes_object_unset_dimension;
+       php_pqtypes_object_handlers.write_dimension = php_pqtypes_object_write_dimension;
 
        zend_hash_init(&php_pqtypes_object_prophandlers, 1, NULL, php_pq_object_prophandler_dtor, 1);
 
 
        zend_hash_init(&php_pqtypes_object_prophandlers, 1, NULL, php_pq_object_prophandler_dtor, 1);