php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46502 Instanciate class that inherits from an abstract one
Submitted: 2008-11-06 12:49 UTC Modified: 2008-11-06 13:22 UTC
From: frajper at gmail dot com Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 5.2CVS-2008-11-06 (snap) OS: RHEL 4
Private report: No CVE-ID: None
 [2008-11-06 12:49 UTC] frajper at gmail dot com
Description:
------------
In the same file, you cannot instanciate an object of a child-class that extends an abstract one before the child-class has been defined.

// The following code does not work //

$s = new Son ();

abstract class Bird {}

class Father extends Dove {}

Reproduce code:
---------------
Fatal error: Class 'Import_ald' not found in /home/enric00/no_public/import/Import_ald.php on line 7


Expected result:
----------------
Normal execution


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-06 12:59 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 [2008-11-06 13:20 UTC] frajper at gmail dot com
Excuse me, but I did a mistake while writing the report. The correct one is as follows:

// The following code does not work //

$s = new Dove();

abstract class Bird {}

class Father extends Dove {}
 [2008-11-06 13:22 UTC] frajper at gmail dot com
Excuse me again,

this is the goog one. (Sorry)

// The following code does not work //

$s = new Dove();

abstract class Bird {}

class Dove extends Bird{}
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Nov 21 07:00:01 2025 UTC