]> granicus.if.org Git - php/commitdiff
Fixed bug #30922 (reflective functions crash PHP when interfaces extend themselves)
authorDmitry Stogov <dmitry@php.net>
Mon, 6 Dec 2004 11:53:00 +0000 (11:53 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 6 Dec 2004 11:53:00 +0000 (11:53 +0000)
NEWS
Zend/tests/bug30922.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/NEWS b/NEWS
index 37448f470537c9fc388ae4b47e345bdf0f16832d..26329613e76ca39ff0ce125ec6a39756e4ac52b7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ PHP                                                                        NEWS
 - Fixed potential problems with unserializing invalid serialize data. (Marcus)
 - Fixed bug #30967 (properties in extended mysqli classes don't work). (Georg)
 - Fixed bug #30962 (mssql returns space for NULL columns). (Ilia)
+- Fixed bug #30922 (reflective functions crash PHP when interfaces extend
+  themselves). (Tony, Dmitry)
 - Fixed bug #30890 (MySQLi testsuite)
 - Fixed bug #30856 (ReflectionClass::getStaticProperties segfaults). (Marcus)
 - Fixed bug #30832 ("!" stripped off comments in xml parser). (Rob)
diff --git a/Zend/tests/bug30922.phpt b/Zend/tests/bug30922.phpt
new file mode 100644 (file)
index 0000000..24d7917
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Bug #30922 (reflective functions crash PHP when interfaces extend themselves)
+--FILE--
+<?php
+interface RecurisiveFooFar extends RecurisiveFooFar {}
+class A implements RecurisiveFooFar {}
+
+$a = new A();
+var_dump($a instanceOf A);
+echo "ok\n";
+?>
+--EXPECTF--
+Fatal error: Interface RecurisiveFooFar cannot not implement itself in %sbug30922.php on line %d
index b3f8ae366d396c4903cb37b721a44dbe26912268..2c7c5c492c1170882afc4e4dc1c4779526ac1cce 100644 (file)
@@ -1928,6 +1928,9 @@ static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry
        if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce TSRMLS_CC) == FAILURE) {
                zend_error(E_CORE_ERROR, "Class %s could not implement interface %s", ce->name, iface->name);
        }
+       if (ce == iface) {
+               zend_error(E_ERROR, "Interface %s cannot not implement itself", ce->name);
+       }
 }