diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-16 12:32:43 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-16 12:33:50 +0100 |
commit | cb9785add1bc8031531c2870c267e6a72efae6af (patch) | |
tree | 2cf4e2c401fbb3f6654665038dcd1f9e94605836 /ext | |
parent | 2dc75a9e934b5714c0d3b540d341b86a65ee8b6c (diff) | |
download | php-git-cb9785add1bc8031531c2870c267e6a72efae6af.tar.gz |
Fixed bug #80723
This fixes the issue just for the Socket class. Presumably we'll
want to do the same for other "resource" objects.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/sockets/sockets.c | 1 | ||||
-rw-r--r-- | ext/sockets/tests/bug80723.phpt | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 6118610cac..368e61b0ed 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -446,6 +446,7 @@ static PHP_MINIT_FUNCTION(sockets) socket_object_handlers.get_constructor = socket_get_constructor; socket_object_handlers.clone_obj = NULL; socket_object_handlers.get_gc = socket_get_gc; + socket_object_handlers.compare = zend_objects_not_comparable; zend_class_entry ce_address_info; INIT_CLASS_ENTRY(ce_address_info, "AddressInfo", class_AddressInfo_methods); diff --git a/ext/sockets/tests/bug80723.phpt b/ext/sockets/tests/bug80723.phpt new file mode 100644 index 0000000000..a05d857900 --- /dev/null +++ b/ext/sockets/tests/bug80723.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #80723: Different sockets compare as equal (regression in 8.0) +--FILE-- +<?php +$socket_1 = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); +$socket_2 = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); +var_dump($socket_1 == $socket_1); +var_dump($socket_2 == $socket_2); +var_dump($socket_1 == $socket_2); + +$vector = array(1 => $socket_1, 2 => $socket_2); +var_dump(array_search($socket_1, $vector)); +var_dump(array_search($socket_2, $vector)); + +?> +--EXPECT-- +bool(true) +bool(true) +bool(false) +int(1) +int(2) |