Page 1 of 1

stdClass and __set

Posted: Wed Oct 13, 2010 10:41 am
by droberts
Hello.

I have an object I created from class Post.

Code: Select all

$p = new Post();

get_class($p) 
will return the class Post.

After I assign a variable to the class using the magic method __set

Code: Select all

$p->datereceived = "1234";

Code: Select all

get_class($p)
will return stdClass.

Why did the class change?

Re: stdClass and __set

Posted: Wed Oct 13, 2010 12:13 pm
by AbraCadaver
It shouldn't. There must be something else in your code.

Re: stdClass and __set

Posted: Wed Oct 13, 2010 1:07 pm
by John Cartwright
AbraCadaver wrote:It shouldn't. There must be something else in your code.
In fact I just ran a quick test on 5.3.1, and did not experience the said behavior.

Re: stdClass and __set

Posted: Fri Oct 15, 2010 8:29 am
by droberts
I think this was happening because I was trying to pull an object out of an array by the wrong key.