summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/no-write-properties-through-references.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/enum/no-write-properties-through-references.phpt')
-rw-r--r--Zend/tests/enum/no-write-properties-through-references.phpt23
1 files changed, 23 insertions, 0 deletions
diff --git a/Zend/tests/enum/no-write-properties-through-references.phpt b/Zend/tests/enum/no-write-properties-through-references.phpt
new file mode 100644
index 0000000000..81543af78d
--- /dev/null
+++ b/Zend/tests/enum/no-write-properties-through-references.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Enum properties cannot be written to through references
+--FILE--
+<?php
+
+enum Foo: int {
+ case Bar = 0;
+}
+
+try {
+ $bar = Foo::Bar;
+ $value = &$bar->value;
+ $value = 1;
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+var_dump(Foo::Bar->value);
+
+?>
+--EXPECT--
+Cannot acquire reference to property Foo::$value
+int(0)