470,862 Members | 1,846 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,862 developers. It's quick & easy.

PHP class inheritance bug?

http://www.phpbuilder.com/board/show...2#post10541092

I can't explain it better than to show you my thread

Environments: PHP 4.1.2 and 4.3.2

Scenario:

I have a script ../classes.inc.php which serves as a "JAR" file of PHP
classes that pertain to the entire application at application-level
scope. The script consists of about 25 different classes, of which
any class that extends OptionsView fails and produces this error:

Fatal error: Class fooview: Cannot inherit from undefined class
optionsview in /classes/classes.inc.php in line 2836

Here is code that consists of line 2836:

[PHP]

class AlbumOptionsView extends PaginationView { // THIS ONE IS JUST
FINE!

}

class FooView extends OptionsView { // BOMBS THIS IS LINE 2836

}

class OptionsView extends PaginationView {

}

class BlahView extends OptionsView { // THIS ONE IS JUST FINE

}

class Blah2View extends PaginationView { // THIS ONE IS FINE TOO!

}

class PaginationView extends View {

}
[/PHP]
However, if any class exists *physically placed after* OptionsView in
the script, and it extends OptionsView, everything is ok.

NOTE: This does not occur with any other class. If any class extends
any other class in the same script, no matter where it's placed,
everything is just fine.

I went so far as to literally strip out all code from OptionsView - to
no avail, same error.
Jul 17 '05 #1
1 1650
Phil Powell wrote:
class AlbumOptionsView extends PaginationView { // THIS ONE IS JUST
FINE!

}

class FooView extends OptionsView { // BOMBS THIS IS LINE 2836

}

class OptionsView extends PaginationView {

}


Define OptionsView *before* FooView.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Ricky Romaya | last post: by
6 posts views Thread by Brian Jones | last post: by
22 posts views Thread by Marcin Vorbrodt | last post: by
9 posts views Thread by mead | last post: by
4 posts views Thread by KInd | last post: by
166 posts views Thread by Graham | last post: by
11 posts views Thread by Darren.Ratcliffe | last post: by
3 posts views Thread by hurcan solter | last post: by
3 posts views Thread by Jam | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.