473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Object Error

162 100+
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.

Expand|Select|Wrap|Line Numbers
  1. Undefined property:  object::$core in /var/www/vhosts/site.com/httpdocs/index.php
It is referencing a script i use like -

Expand|Select|Wrap|Line Numbers
  1. // set object //
  2. class object {};
  3. $SITE = new object;
  4.  
  5. // difine //
  6. $SITE->core = 'test string';
  7.  
  8. // in use //
  9. echo"$SITE->core";
  10.  
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.
May 11 '06 #1
3 2227
nathj
938 Expert 512MB
I know this an old post and the issue has probably been sorted but I'm just trying to help out.

Looking at the code sample you haven't said that core is property of the class. try:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. class myObject
  3. {
  4.  var $core ;
  5. }
  6.  
  7. $site = new myObject() ;
  8.  
  9. $site->core = "hello world" ;
  10.  
  11. echo $site->core ;
  12. ?>
  13.  
Cheers
nathj
Dec 16 '08 #2
Markus
6,050 Expert 4TB
It makes sense that you can't access properties a class doesn't have. No?

Anyway, in the CodeIgniter framework, you can create properties on the fly. That's done like:

Expand|Select|Wrap|Line Numbers
  1. // 'new_property' doesn't exist until:
  2. $this->new_property = "A new property";
  3.  
I'm not quite sure how they do that, but someone else might.
Dec 16 '08 #3
Markus
6,050 Expert 4TB
Actually, in PHP 5.2.0, creating properties on the fly works fine. I was unaware of that ability..

Expand|Select|Wrap|Line Numbers
  1. class Test { };
  2.  
  3. $test = new Test;
  4.  
  5. $test->new_property = "testing";
  6.  
  7. echo $test->new_property;
  8.  
Works just fine for me, but, like I said, that is 5.2.0
Dec 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server...
2
by: Nithi Gurusamy | last post by:
Dear Group: I have a COM object developed in VB. It makes ADODB calls. When it fails it Raise Error. I am using the COM object in my ASP using Server.CreateObject. Whenever a function call fails...
9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
8
by: mcmg | last post by:
Hi, I have an asp app that works fine on a windows xp machine but does not work on a windows 2000 server. I have the following code in my global.asa: <OBJECT RUNAT=Server SCOPE=SESSION...
2
by: Roby Eisenbraun Martins | last post by:
Hi, My name is Roby Eisenbraun Martins, I am a C++, VB and NET developer. I am working with a NET 2002 project right now and I am receiving this uncommon "OutOfMemory" error message when I try...
0
by: Dirk Försterling | last post by:
Hi all, a few days ago, I upgraded from PostgreSQL 7.2.1 to 7.4, following the instructions in the INSTALL file, including dump and restore. All this worked fine without any error (message). ...
0
by: Roman | last post by:
I'm trying to create the form which would allow data entry to the Client table, as well as modification and deletion of existing data rows. For some reason the DataGrid part of functionality stops...
6
by: blash | last post by:
Can someone help me? I really don't have a clue. My company staff told me they often got such error: "Object reference not set to an instance of an object." when they are in search result page...
1
by: J. Askey | last post by:
I am implementing a web service and thought it may be a good idea to return a more complex class (which I have called 'ServiceResponse') in order to wrap the original return value along with two...
2
by: Moses | last post by:
Hi All, Is is possible to catch the error of an undefined element while creating an object for it. Consider we are not having an element with id indicator but we are trying to make the object...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.