php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37753 Classes implementing interfaces may not be initiated before declaration
Submitted: 2006-06-08 21:20 UTC Modified: 2006-06-08 21:26 UTC
From: rollercoaster397 at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.1.4 OS: Any
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: rollercoaster397 at gmail dot com
New email:
PHP Version: OS:

 

 [2006-06-08 21:20 UTC] rollercoaster397 at gmail dot com
Description:
------------
When a Class implements an interface, the class may not be initialized before the declaration of this class.

Reproduce code:
---------------
$test = new Test;
echo $test;

interface Something {
	function increment ();
}

class Test implements Something {
	public $value = 0;
	
	function increment () {
		$this->value++;
		return $this->value;
	}
}

Expected result:
----------------
Object id #1

Actual result:
--------------
Fatal error: Class 'Test' not found in *path*/testcast.php on line 3

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-08 21:26 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

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 07 17:01:27 2024 UTC