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 7c695ffd511923c0270f23f028e4125495c09c37..b9ce32d5c9dac4bf8c2cac77eadbfc9049fe0891 100644 (file)
@@ -203,7 +203,7 @@ zval *php_pq_object_read_prop(zval *object, zval *member, int type, void **cache
        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;
@@ -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);
        }
+#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) {
index 2c7417a6e6d61369c26ee6ad8a46a43a868601b4..a274dd4bb2556b901d2ad648f756cacf816b981f 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);
-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
index edf8b109c28b1799099b6f6bac0a4b6123b7ea16..e3b6ed7652304e65b2890686afd6cbaefb0baa48 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.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;
index 9b507b62591d381d042e1a0b082a67d9b80cb676..e3ca68ffaaaba95bfd1d880f3018956879f77730 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.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;
index e94567945e8784088d7eb3bc7334f5c9cea29418..1ab3ad984f561099fab0c4c928c564aace4f4e9f 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.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;
index 9989533f967ef58e05e8685f4900f739f8c4ddf7..6dcd83e3823222ba63678ca7bd9e3395f5da3315 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.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;
index 5d1f6ba7e00b5328a1504beeb01a7bcae7ce1754..006eb751abde6fd2615013aa23bc12a0a84696f6 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.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;
index 76384451ce59db61e816524c571c1bc6c4475f84..6e8bb0754ba75bab10c109c50c3882480405794f 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.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;
index a5caa1bd5f5bff865cfe2faaadd40f21694f7726..60f4bc88133d215d71a9aec100d79cd00e2654fe 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.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;
index 70b7ec91d797ea5e10bff10d540d4963b4e82bb3..ebcb44d806e7df3c25869dc0ae4d1592741a2b23 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.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;
index e1d22ad0a9679bea94f18f9ec054613c9d100152..323883c778b264ab852c3c5465f650e674be694f 100644 (file)
@@ -143,6 +143,16 @@ static zval *php_pqtypes_object_read_dimension(zval *object, zval *member, int t
        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)
@@ -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.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.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);