]> granicus.if.org Git - php/commitdiff
fix inheritance of internal interfaces with constants
authorMichael Wallner <mike@php.net>
Tue, 18 Aug 2015 06:19:59 +0000 (08:19 +0200)
committerMichael Wallner <mike@php.net>
Tue, 18 Aug 2015 06:20:12 +0000 (08:20 +0200)
Zend/zend_inheritance.c

index 77ea7d5f3fb760d5afcb67b3ca4c97f5ef3248a3..3ccade9d0e1a6671201101f14143c9ea0eec0bc8 100644 (file)
@@ -917,7 +917,13 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zva
 static void do_inherit_iface_constant(zend_string *name, zval *zv, zend_class_entry *ce, zend_class_entry *iface) /* {{{ */
 {
        if (do_inherit_constant_check(&ce->constants_table, zv, name, iface)) {
-               ZVAL_MAKE_REF(zv);
+               if (!Z_ISREF_P(zv)) {
+                       if (iface->type == ZEND_INTERNAL_CLASS) {
+                               ZVAL_NEW_PERSISTENT_REF(zv, zv);
+                       } else {
+                               ZVAL_NEW_REF(zv, zv);
+                       }
+               }
                Z_ADDREF_P(zv);
                if (Z_CONSTANT_P(Z_REFVAL_P(zv))) {
                        ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED;