Skip to content

Commit 98b3c24

Browse files
committed
Fixed implementation of internal interfaces in namesapces
1 parent 4b731b1 commit 98b3c24

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

Zend/tests/ns_054.phpt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
054: namespace and interfaces
3+
--SKIPIF--
4+
<?php if (!extension_loaded("spl")) die("skip SPL is no available"); ?>
5+
--FILE--
6+
<?php
7+
namespace test::ns1;
8+
9+
class Foo implements SplObserver {
10+
function update(::SplSubject $x) {
11+
echo "ok\n";
12+
}
13+
}
14+
15+
class Bar implements SplSubject {
16+
function attach(::SplObserver $x) {
17+
echo "ok\n";
18+
}
19+
function notify() {
20+
}
21+
function detach(::SplObserver $x) {
22+
}
23+
}
24+
$foo = new Foo();
25+
$bar = new Bar();
26+
$bar->attach($foo);
27+
$foo->update($bar);
28+
?>
29+
--EXPECT--
30+
ok
31+
ok

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3136,7 +3136,7 @@ void zend_do_implements_interface(znode *interface_name TSRMLS_DC)
31363136
if (CG(active_op_array)->last > 0) {
31373137
opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
31383138
if (opline->opcode == ZEND_FETCH_CLASS) {
3139-
opline->extended_value = ZEND_FETCH_CLASS_INTERFACE;
3139+
opline->extended_value = (opline->extended_value & ~ZEND_FETCH_CLASS_MASK) | ZEND_FETCH_CLASS_INTERFACE;
31403140
}
31413141
}
31423142
break;

0 commit comments

Comments
 (0)