php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wolfgang dot forstmeier at siemens dot com
New email:
PHP Version: OS:

 

 [2004-04-13 09:54 UTC] wolfgang dot forstmeier at siemens dot com
Description:
------------
Hi,

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
<?php
class f {
 var $f = null;
 function f() {
 	$this->f = 5;
 }
}
?>
File 2 with Class 2
<?php
require_once('test_a.php');
$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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-13 10:13 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

You need to declared classes before use if you inherit them.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Nov 30 10:03:35 2021 UTC