From: Dmitry Stogov Date: Mon, 6 Dec 2004 11:53:00 +0000 (+0000) Subject: Fixed bug #30922 (reflective functions crash PHP when interfaces extend themselves) X-Git-Tag: php-5.0.3RC2~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=763006984d8105394c4ae6ecdbf7f4b6188f6d7c;p=php Fixed bug #30922 (reflective functions crash PHP when interfaces extend themselves) --- diff --git a/NEWS b/NEWS index 37448f4705..26329613e7 100644 --- 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 index 0000000000..24d79171be --- /dev/null +++ b/Zend/tests/bug30922.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #30922 (reflective functions crash PHP when interfaces extend themselves) +--FILE-- + +--EXPECTF-- +Fatal error: Interface RecurisiveFooFar cannot not implement itself in %sbug30922.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b3f8ae366d..2c7c5c492c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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); + } }