ID:               37233
 Updated by:       [EMAIL PROTECTED]
 Reported By:      paul at stunning-stuff dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Win XP Pro SP2
 PHP Version:      5.1.2
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.




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

[2006-04-28 06:27:35] paul at stunning-stuff dot com

Description:
------------
I have seen 2 reports (#30452 & #30453) that seem similar to this bug.
Both of them were closed with the message 'Won't fix'. I don't think
this is fair, it is a bug and it should be fixed because it seriously
limits the OOP capabilities of PHP5. I included a feasible real-world
example that shows why this bug should be fixed (I tried to make it as
short as possible).

Running index.php will cause a Fatal Error because Manager could not be
found in language_manager.class.php on line 6. This happens because
Manager is declared after LanguageManager is declared, even though
(visually) manager.class.php is included before
language_manager.class.php. The strange thing is, when Manager doesn't
implement the interface Whatever, everything is fine!
If it works without an interface it should work with an interface as
well.

Thanks for the time and effort you guys spend on making a great
programming language. I know it's free, so I am not going to demand a
fix :-), I'll just say 'pretty please' instead ;-).

Thanks,

Paul

Reproduce code:
---------------
index.php
<?php

// We require this file because we plan to use a manager object in
here.
require_once 'manager.class.php';

?>

manager.class.php
<?php

// Manager implements Whatever.
require_once 'whatever.class.php';

// Manager uses LanguageManager to translate errors.
require_once 'language_manager.class.php';

class Manager implements Whatever
{
  public function functionCausingError()
  {
    // LanguageManager is used to translate an error caused in this
function.
    $languageManager = new LanguageManager();
  }
}

?>

language_manager.class.php
<?php

// LanguageManager extends Manager.
require_once 'manager.class.php';

class LanguageManager extends Manager
{
}

?>

whatever.class.php
<?php

interface Whatever
{
}

?>

Expected result:
----------------
No output

Actual result:
--------------
Fatal error: Class 'Manager' not found in C:\Web Server\Web
Root\sandbox\bug\language_manager.class.php on line 6


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


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

Reply via email to