]> granicus.if.org Git - php/commitdiff
Remove obj handlers ptr value from spl_object_hash()
authorBogdan Padalko <pinepain@gmail.com>
Mon, 11 Jan 2016 23:26:34 +0000 (01:26 +0200)
committerNikita Popov <nikic@php.net>
Tue, 12 Jan 2016 15:47:21 +0000 (16:47 +0100)
We still keep the same output length, for people who rely on the
return value having a specific format. The handler part will now
simply be always the same (it was the same nearly always anyway).

The motivation behind this change is to avoid breaking
spl_object_hash() and SplObjectStorage if an extension changes the
handlers table of an object. This has come up, for example, in
weakref implementations.

ext/spl/php_spl.c

index 57e43d4fae4983bc3dff907e17ab2f5cdc115a8f..9c7611d117a2f1170efa3b8db4f5c3c508ceec9c 100644 (file)
@@ -777,7 +777,7 @@ PHPAPI zend_string *php_spl_object_hash(zval *obj) /* {{{*/
        }
 
        hash_handle   = SPL_G(hash_mask_handle)^(intptr_t)Z_OBJ_HANDLE_P(obj);
-       hash_handlers = SPL_G(hash_mask_handlers)^(intptr_t)Z_OBJ_HT_P(obj);
+       hash_handlers = SPL_G(hash_mask_handlers);
 
        return strpprintf(32, "%016lx%016lx", hash_handle, hash_handlers);
 }