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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 - 20 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC