]> granicus.if.org Git - php/commitdiff
Fixed implementation of internal interfaces in namesapces
authorDmitry Stogov <dmitry@php.net>
Fri, 9 Nov 2007 12:15:41 +0000 (12:15 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 9 Nov 2007 12:15:41 +0000 (12:15 +0000)
Zend/tests/ns_054.phpt [new file with mode: 0755]
Zend/zend_compile.c

diff --git a/Zend/tests/ns_054.phpt b/Zend/tests/ns_054.phpt
new file mode 100755 (executable)
index 0000000..0eb9e04
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+054: namespace and interfaces
+--SKIPIF--
+<?php if (!extension_loaded("spl")) die("skip SPL is no available"); ?>
+--FILE--
+<?php
+namespace test::ns1;
+
+class Foo implements SplObserver {
+       function update(::SplSubject $x) {
+               echo "ok\n";
+       }
+}
+
+class Bar implements SplSubject {
+       function attach(::SplObserver $x) {
+               echo "ok\n";
+       }
+       function notify() {
+       }
+       function detach(::SplObserver $x) {
+       }
+}
+$foo = new Foo();
+$bar = new Bar();
+$bar->attach($foo);
+$foo->update($bar);
+?>
+--EXPECT--
+ok
+ok
index e4a38f304683f13b3a6220ff94c29a48504b31e4..4d70797daaad09991ce521262bfbecf0c37c6862 100644 (file)
@@ -3136,7 +3136,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC)
                        if (CG(active_op_array)->last > 0) {
                                opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
                                if (opline->opcode == ZEND_FETCH_CLASS) {
-                                       opline->extended_value = ZEND_FETCH_CLASS_INTERFACE;
+                                       opline->extended_value = (opline->extended_value & ~ZEND_FETCH_CLASS_MASK) | ZEND_FETCH_CLASS_INTERFACE;
                                }
                        }
                        break;