From d7871d891a32d77df66ce5738dbd2a5a25d5a504 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 13 Jun 2023 16:13:08 +0200 Subject: [PATCH] new properties are read only --- src/php_pq_misc.h | 3 +++ src/php_pqconn.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/php_pq_misc.h b/src/php_pq_misc.h index d86beeb..dab24ec 100644 --- a/src/php_pq_misc.h +++ b/src/php_pq_misc.h @@ -101,6 +101,9 @@ extern int php_pq_compare_index(const void *lptr, const void *rptr); ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) #endif +#ifndef ZEND_ACC_READONLY +#define ZEND_ACC_READONLY 0 +#endif extern PHP_MINIT_FUNCTION(pq_misc); diff --git a/src/php_pqconn.c b/src/php_pqconn.c index 0e9e32f..19ea6f0 100644 --- a/src/php_pqconn.c +++ b/src/php_pqconn.c @@ -2160,19 +2160,19 @@ PHP_MINIT_FUNCTION(pqconn) ph.write = NULL; #ifdef HAVE_PQLIBVERSION - zend_declare_property_null(php_pqconn_class_entry, ZEND_STRL("libraryVersion"), ZEND_ACC_PUBLIC); + zend_declare_property_null(php_pqconn_class_entry, ZEND_STRL("libraryVersion"), ZEND_ACC_PUBLIC|ZEND_ACC_READONLY); ph.read = php_pqconn_object_read_lib_version; zend_hash_str_add_mem(&php_pqconn_object_prophandlers, ZEND_STRL("libraryVersion"), (void *) &ph, sizeof(ph)); #endif #ifdef HAVE_PQPROTOCOLVERSION - zend_declare_property_null(php_pqconn_class_entry, ZEND_STRL("protocolVersion"), ZEND_ACC_PUBLIC); + zend_declare_property_null(php_pqconn_class_entry, ZEND_STRL("protocolVersion"), ZEND_ACC_PUBLIC|ZEND_ACC_READONLY); ph.read = php_pqconn_object_read_protocol_version; zend_hash_str_add_mem(&php_pqconn_object_prophandlers, ZEND_STRL("protocolVersion"), (void *) &ph, sizeof(ph)); #endif #ifdef HAVE_PQSERVERVERSION - zend_declare_property_null(php_pqconn_class_entry, ZEND_STRL("serverVersion"), ZEND_ACC_PUBLIC); + zend_declare_property_null(php_pqconn_class_entry, ZEND_STRL("serverVersion"), ZEND_ACC_PUBLIC|ZEND_ACC_READONLY); ph.read = php_pqconn_object_read_server_version; zend_hash_str_add_mem(&php_pqconn_object_prophandlers, ZEND_STRL("serverVersion"), (void *) &ph, sizeof(ph)); #endif -- 2.30.2