php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29041 Will not execute extended class from before declaration
Submitted: 2004-07-07 03:31 UTC Modified: 2004-07-07 09:17 UTC
From: torr0101 at hotmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.0.0RC3 OS: Windows 2003 Standard
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: torr0101 at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-07-07 03:31 UTC] torr0101 at hotmail dot com
Description:
------------
When you create a normal class you can call it before the class is defined on the page.  However, when you extend a class you cannot instantiate the class before it is declared.  It will not be found.

Reproduce code:
---------------
<?php
require_once('controller.php');

$l = new Login();

class Login extends Controller
{
	function __construct()
	{
		parent::__construct();
		echo('Extended');
	}
}
?>

Expected result:
----------------
Extended

Actual result:
--------------
Fatal error: Class 'Login' not found in ...\test.php on line 4 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-07 09:17 UTC] derick@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

This is expected behavior, and documented here:
http://php/manual/en/keyword.extends.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 06:01:27 2025 UTC