|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27977 PHP object creation crashes
Submitted: 2004-04-13 09:54 UTC Modified: 2004-04-13 10:13 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: wolfgang dot forstmeier at siemens dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
 [2004-04-13 09:54 UTC] wolfgang dot forstmeier at siemens dot com

if you create an object befor you had described your class this will let crash your php code.
If you create the object after you had described your class code all is fine.

Reproduce code:
File 1 with Class 1
class f {
 var $f = null;
 function f() {
 	$this->f = 5;
File 2 with Class 2
$b = new xy();
class xy extends f{
	function xy() {
		echo $this->f;

Expected result:
The output had to be 5 

Actual result:
Fatal error: Cannot instantiate non-existent class: xy in c:\server_scripts\htdocs\scripts\test.php on line 3


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-13 10:13 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

You need to declared classes before use if you inherit them.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 04:01:28 2024 UTC