Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Error

Status
Not open for further replies.

cesarcesar

Programmer
Mar 5, 2003
30
I have just recently updated my server to PHP 5.1. I am getting a grip of errors in my logs now related to an object i use. This is just one of the error.

Code:
Undefined property:  object::$core in /var/www/vhosts/site.com/httpdocs/index.php

It is referencing a script i use like -

Code:
// set object //
class object {};
$SITE = new object;

// difine //
$SITE->core = 'test string';

// in use //
echo"$SITE->core";

Has this type of object usage degraded in 5.1, or is there something i need to set in my now updated php.ini file.

Thanks.
 
i'm not sure that what you set out above is good practice. i've always thought that it was better to declare variables in the class or its constructor.

but I can confirm that the implicit instantiation of class scope variables that you refer to above works in php 5.1.1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top