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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 08:01:33 2024 UTC