summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/unserialize-refcount.phpt
diff options
context:
space:
mode:
authorIlija Tovilo <ilija.tovilo@me.com>2020-06-10 23:10:18 +0200
committerIlija Tovilo <ilija.tovilo@me.com>2021-03-17 19:08:03 +0100
commit269c8dac1d56ee85d71ae94d9b28dd7d8e8de7b7 (patch)
tree810ac41b2157ff4e8063f9696f97e1a9d77837c4 /Zend/tests/enum/unserialize-refcount.phpt
parenta6fc427b8c51015c16541c112a26dd06bd75e99e (diff)
downloadphp-git-269c8dac1d56ee85d71ae94d9b28dd7d8e8de7b7.tar.gz
Implement enums
RFC: https://wiki.php.net/rfc/enumerations Co-authored-by: Nikita Popov <nikita.ppv@gmail.com> Closes GH-6489.
Diffstat (limited to 'Zend/tests/enum/unserialize-refcount.phpt')
-rw-r--r--Zend/tests/enum/unserialize-refcount.phpt45
1 files changed, 45 insertions, 0 deletions
diff --git a/Zend/tests/enum/unserialize-refcount.phpt b/Zend/tests/enum/unserialize-refcount.phpt
new file mode 100644
index 0000000000..447b3af182
--- /dev/null
+++ b/Zend/tests/enum/unserialize-refcount.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Enum unserialize refcount
+--FILE--
+<?php
+
+enum Foo {
+ case Bar;
+}
+
+debug_zval_dump(Foo::Bar);
+
+$foo = Foo::Bar;
+debug_zval_dump($foo);
+
+$bar = unserialize('E:7:"Foo:Bar";');
+debug_zval_dump($foo);
+
+unset($bar);
+debug_zval_dump($foo);
+
+unset($foo);
+debug_zval_dump(Foo::Bar);
+
+?>
+--EXPECT--
+object(Foo)#1 (1) refcount(2){
+ ["name"]=>
+ string(3) "Bar" interned
+}
+object(Foo)#1 (1) refcount(3){
+ ["name"]=>
+ string(3) "Bar" interned
+}
+object(Foo)#1 (1) refcount(4){
+ ["name"]=>
+ string(3) "Bar" interned
+}
+object(Foo)#1 (1) refcount(3){
+ ["name"]=>
+ string(3) "Bar" interned
+}
+object(Foo)#1 (1) refcount(2){
+ ["name"]=>
+ string(3) "Bar" interned
+}