ID:               30922
 Updated by:       [EMAIL PROTECTED]
 Reported By:      Jason at AMP-design dot net
 Status:           Assigned
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows 2003
 PHP Version:      5.0.2
 Assigned To:      andi
 New Comment:

Reproduced with HEAD too.
Please, review the patch below:

Index: zend_compile.c
===================================================================
RCS file: /repository/ZendEngine2/zend_compile.c,v
retrieving revision 1.600
diff -u -r1.600 zend_compile.c
--- zend_compile.c      16 Oct 2004 23:17:58 -0000      1.600
+++ zend_compile.c      28 Nov 2004 17:48:34 -0000
@@ -1997,6 +1997,10 @@
        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_CORE_ERROR, "Interface %s cannot not
implement itself", ce->name);
+       }
 }


Previous Comments:
------------------------------------------------------------------------

[2004-11-28 18:40:08] Jason at AMP-design dot net

Description:
------------
When a interface extends it's self, it will cause PHP to crash when
reflective language features such as instanceOf, is_a are used on
objects that implement the recursive interface.

Reproduce code:
---------------
<?php

interface RecurisiveFooFar extends RecurisiveFooFar {}
class A implements RecurisiveFooFar {}

$a = new A();
var_dump($a instanceOf A);

?>

Expected result:
----------------
Something like ...

Fatal Error: interface can not extend it's self on line __LINE__ in
__FILE__

Actual result:
--------------
PHP Crashes. Apache log shows this activity.

[Sun Nov 28 15:47:43 2004] [notice] Parent: child process exited with
status 128 -- Restarting.
[Sun Nov 28 15:47:43 2004] [notice] Parent: Created child process 3932
[Sun Nov 28 15:47:43 2004] [notice] Child 3932: Child process is
running
[Sun Nov 28 15:47:43 2004] [notice] Child 3932: Acquired the start
mutex.
[Sun Nov 28 15:47:43 2004] [notice] Child 3932: Starting 250 worker
threads.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30922&edit=1

Reply via email to