|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67848 Problem at create new instance of class
Submitted: 2014-08-15 14:19 UTC Modified: 2015-03-02 20:46 UTC
From: eduardbader at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: Irrelevant OS: debian 7.5 (wheezy)
Private report: No CVE-ID: None
 [2014-08-15 14:19 UTC] eduardbader at gmail dot com
From manual page:
Fatal error when class defined before parent class. The parent class should implement an interface.

Test script:

interface FooInterface {}
class DoesNotWorksOnTopOfFile extends Bar {}

class Bar implements FooInterface{}

class WorksOnBottom extends Bar {}

Expected result:
no errors expected

Actual result:
Class 'Bar' not found in /tmp/Bar.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-02 19:05 UTC] cmbecker69 at gmx dot de
This is not a bug.

It is well documented[1] that

| Unless autoloading is used, then classes must be defined before
| they are used. If a class extends another, then the parent class
| must be declared before the child class structure. This rule
| applies to classes that inherit other classes and interfaces.

[1] <>
 [2015-03-02 20:46 UTC]
-Status: Open +Status: Not a bug
 [2015-03-02 20:46 UTC]
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 06:01:28 2024 UTC