diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-16 14:20:45 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-16 14:20:45 +0100 |
commit | b63ea1047a5c130231cec5571861f1dcdf63a063 (patch) | |
tree | 0fff21141ba410ca439833f64b41e86a1d22e2b4 /ext | |
parent | cb9785add1bc8031531c2870c267e6a72efae6af (diff) | |
download | php-git-b63ea1047a5c130231cec5571861f1dcdf63a063.tar.gz |
Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/curl/interface.c | 1 | ||||
-rw-r--r-- | ext/curl/multi.c | 1 | ||||
-rw-r--r-- | ext/curl/share.c | 1 | ||||
-rw-r--r-- | ext/enchant/enchant.c | 2 | ||||
-rw-r--r-- | ext/gd/gd.c | 1 | ||||
-rw-r--r-- | ext/openssl/openssl.c | 3 | ||||
-rw-r--r-- | ext/shmop/shmop.c | 1 | ||||
-rw-r--r-- | ext/sockets/sockets.c | 1 | ||||
-rw-r--r-- | ext/sysvmsg/sysvmsg.c | 1 | ||||
-rw-r--r-- | ext/sysvsem/sysvsem.c | 1 | ||||
-rw-r--r-- | ext/sysvshm/sysvshm.c | 1 | ||||
-rw-r--r-- | ext/xml/xml.c | 1 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 2 |
13 files changed, 17 insertions, 0 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 2fd6ec1454..808785c445 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1200,6 +1200,7 @@ PHP_MINIT_FUNCTION(curl) curl_object_handlers.get_constructor = curl_get_constructor; curl_object_handlers.clone_obj = curl_clone_obj; curl_object_handlers.cast_object = curl_cast_object; + curl_object_handlers.compare = zend_objects_not_comparable; curl_multi_register_class(class_CurlMultiHandle_methods); curl_share_register_class(class_CurlShareHandle_methods); diff --git a/ext/curl/multi.c b/ext/curl/multi.c index e717fd5d9e..3b329088c2 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -603,4 +603,5 @@ void curl_multi_register_class(const zend_function_entry *method_entries) { curl_multi_handlers.get_constructor = curl_multi_get_constructor; curl_multi_handlers.clone_obj = NULL; curl_multi_handlers.cast_object = curl_cast_object; + curl_multi_handlers.compare = zend_objects_not_comparable; } diff --git a/ext/curl/share.c b/ext/curl/share.c index 58135acdb5..6ab0f92ba5 100644 --- a/ext/curl/share.c +++ b/ext/curl/share.c @@ -176,4 +176,5 @@ void curl_share_register_class(const zend_function_entry *method_entries) { curl_share_handlers.free_obj = curl_share_free_obj; curl_share_handlers.get_constructor = curl_share_get_constructor; curl_share_handlers.clone_obj = NULL; + curl_share_handlers.compare = zend_objects_not_comparable; } diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 5661975820..b602620c2a 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -199,6 +199,7 @@ PHP_MINIT_FUNCTION(enchant) enchant_broker_handlers.offset = XtOffsetOf(enchant_broker, std); enchant_broker_handlers.free_obj = php_enchant_broker_free; enchant_broker_handlers.clone_obj = NULL; + enchant_broker_handlers.compare = zend_objects_not_comparable; INIT_CLASS_ENTRY(dce, "EnchantDictionary", class_EnchantDictionary_methods); enchant_dict_ce = zend_register_internal_class(&dce); @@ -211,6 +212,7 @@ PHP_MINIT_FUNCTION(enchant) enchant_dict_handlers.offset = XtOffsetOf(enchant_dict, std); enchant_dict_handlers.free_obj = php_enchant_dict_free; enchant_dict_handlers.clone_obj = NULL; + enchant_dict_handlers.compare = zend_objects_not_comparable; REGISTER_LONG_CONSTANT("ENCHANT_MYSPELL", PHP_ENCHANT_MYSPELL, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED); REGISTER_LONG_CONSTANT("ENCHANT_ISPELL", PHP_ENCHANT_ISPELL, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED); diff --git a/ext/gd/gd.c b/ext/gd/gd.c index d009b9b09a..b0abecc6f7 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -232,6 +232,7 @@ static void php_gd_object_minit_helper() php_gd_image_object_handlers.clone_obj = NULL; php_gd_image_object_handlers.free_obj = php_gd_image_object_free; php_gd_image_object_handlers.get_constructor = php_gd_image_object_get_constructor; + php_gd_image_object_handlers.compare = zend_objects_not_comparable; php_gd_image_object_handlers.offset = XtOffsetOf(php_gd_image_object, std); } diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 6d5576efff..340e40a001 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1116,6 +1116,7 @@ PHP_MINIT_FUNCTION(openssl) php_openssl_certificate_object_handlers.free_obj = php_openssl_certificate_free_obj; php_openssl_certificate_object_handlers.get_constructor = php_openssl_certificate_get_constructor; php_openssl_certificate_object_handlers.clone_obj = NULL; + php_openssl_certificate_object_handlers.compare = zend_objects_not_comparable; zend_class_entry csr_ce; INIT_CLASS_ENTRY(csr_ce, "OpenSSLCertificateSigningRequest", class_OpenSSLCertificateSigningRequest_methods); @@ -1130,6 +1131,7 @@ PHP_MINIT_FUNCTION(openssl) php_openssl_request_object_handlers.free_obj = php_openssl_request_free_obj; php_openssl_request_object_handlers.get_constructor = php_openssl_request_get_constructor; php_openssl_request_object_handlers.clone_obj = NULL; + php_openssl_request_object_handlers.compare = zend_objects_not_comparable; zend_class_entry key_ce; INIT_CLASS_ENTRY(key_ce, "OpenSSLAsymmetricKey", class_OpenSSLAsymmetricKey_methods); @@ -1144,6 +1146,7 @@ PHP_MINIT_FUNCTION(openssl) php_openssl_pkey_object_handlers.free_obj = php_openssl_pkey_free_obj; php_openssl_pkey_object_handlers.get_constructor = php_openssl_pkey_get_constructor; php_openssl_pkey_object_handlers.clone_obj = NULL; + php_openssl_pkey_object_handlers.compare = zend_objects_not_comparable; #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) OPENSSL_config(NULL); diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index 3d8975e76f..249359bbdd 100644 --- a/ext/shmop/shmop.c +++ b/ext/shmop/shmop.c @@ -121,6 +121,7 @@ PHP_MINIT_FUNCTION(shmop) shmop_object_handlers.free_obj = shmop_free_obj; shmop_object_handlers.get_constructor = shmop_get_constructor; shmop_object_handlers.clone_obj = NULL; + shmop_object_handlers.compare = zend_objects_not_comparable; return SUCCESS; } diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 368e61b0ed..16ad3e8013 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -461,6 +461,7 @@ static PHP_MINIT_FUNCTION(sockets) address_info_object_handlers.free_obj = address_info_free_obj; address_info_object_handlers.get_constructor = address_info_get_constructor; address_info_object_handlers.clone_obj = NULL; + address_info_object_handlers.compare = zend_objects_not_comparable; REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT); diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index c12eaa0674..a74a149783 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -121,6 +121,7 @@ PHP_MINIT_FUNCTION(sysvmsg) sysvmsg_queue_object_handlers.free_obj = sysvmsg_queue_free_obj; sysvmsg_queue_object_handlers.get_constructor = sysvmsg_queue_get_constructor; sysvmsg_queue_object_handlers.clone_obj = NULL; + sysvmsg_queue_object_handlers.compare = zend_objects_not_comparable; REGISTER_LONG_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT, CONST_PERSISTENT|CONST_CS); REGISTER_LONG_CONSTANT("MSG_EAGAIN", EAGAIN, CONST_PERSISTENT|CONST_CS); diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c index dbde858ab9..0d838d0c89 100644 --- a/ext/sysvsem/sysvsem.c +++ b/ext/sysvsem/sysvsem.c @@ -164,6 +164,7 @@ PHP_MINIT_FUNCTION(sysvsem) sysvsem_object_handlers.free_obj = sysvsem_free_obj; sysvsem_object_handlers.get_constructor = sysvsem_get_constructor; sysvsem_object_handlers.clone_obj = NULL; + sysvsem_object_handlers.compare = zend_objects_not_comparable; return SUCCESS; } diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index e3a6d9501b..c2767aad47 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -112,6 +112,7 @@ PHP_MINIT_FUNCTION(sysvshm) sysvshm_object_handlers.free_obj = sysvshm_free_obj; sysvshm_object_handlers.get_constructor = sysvshm_get_constructor; sysvshm_object_handlers.clone_obj = NULL; + sysvshm_object_handlers.compare = zend_objects_not_comparable; if (cfg_get_long("sysvshm.init_mem", &php_sysvshm.init_mem) == FAILURE) { php_sysvshm.init_mem=10000; diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 3064545739..307608ae8b 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -267,6 +267,7 @@ PHP_MINIT_FUNCTION(xml) xml_parser_object_handlers.get_gc = xml_parser_get_gc; xml_parser_object_handlers.get_constructor = xml_parser_get_constructor; xml_parser_object_handlers.clone_obj = NULL; + xml_parser_object_handlers.compare = zend_objects_not_comparable; REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index eab3b02ca5..75bd273526 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1350,6 +1350,7 @@ static PHP_MINIT_FUNCTION(zlib) inflate_context_object_handlers.free_obj = inflate_context_free_obj; inflate_context_object_handlers.get_constructor = inflate_context_get_constructor; inflate_context_object_handlers.clone_obj = NULL; + inflate_context_object_handlers.compare = zend_objects_not_comparable; zend_class_entry deflate_ce; INIT_CLASS_ENTRY(deflate_ce, "DeflateContext", class_DeflateContext_methods); @@ -1364,6 +1365,7 @@ static PHP_MINIT_FUNCTION(zlib) deflate_context_object_handlers.free_obj = deflate_context_free_obj; deflate_context_object_handlers.get_constructor = deflate_context_get_constructor; deflate_context_object_handlers.clone_obj = NULL; + deflate_context_object_handlers.compare = zend_objects_not_comparable; REGISTER_LONG_CONSTANT("FORCE_GZIP", PHP_ZLIB_ENCODING_GZIP, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FORCE_DEFLATE", PHP_ZLIB_ENCODING_DEFLATE, CONST_CS|CONST_PERSISTENT); |