Bug #67848 [Opn->Nab]: Problem at create new instance of class

From: Date: Mon, 02 Mar 2015 20:46:55 +0000
Subject: Bug #67848 [Opn->Nab]: Problem at create new instance of class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191059@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67848&edit=1

 ID:                 67848
 Updated by:         requinix@php.net
 Reported by:        eduardbader at gmail dot com
 Summary:            Problem at create new instance of class
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Class/Object related
 Operating System:   debian 7.5 (wheezy)
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

That.


Previous Comments:
------------------------------------------------------------------------
[2015-03-02 19:05:05] 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] <http://php.net/manual/en/language.oop5.inheritance.php>

------------------------------------------------------------------------
[2014-08-15 14:19:28] eduardbader at gmail dot com

Description:
------------
---
From manual page: http://www.php.net/language.oop5.interfaces
---
Fatal error when class defined before parent class. The parent class should implement an interface.

Test script:
---------------
<?php

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


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



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


Thread (3 messages)

« previous php.bugs (#191059) next »