This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi I am really struggling to understand what might be going on here. This is the onrun method from a component class that used to work fine until today. Now the class variables are not behaving as you would expect. A simple test shows the problem.
public function onRun()
{
$this->test = 'test';
dd($this->test);
}
This produces an output of null. Does anyone have any clue what might be going on? The weird thing is that it works correctly if the property ($test in this case) is declared explicitly at the top of the class. I did not have to do that until today. I had just done an october update but I really dont think this could have caused the problem. Thanks
Last updated
I have done another test, I used the same code above on a older version of october and it worked fine, just as expected.
Then I upgraded to the latest version and reproduced the same problem. So it looks more like an upgrade problem than I thought. Has anyone else noticed this?
You are trying to do magic.
http://stackoverflow.com/questions/829823/can-you-create-instance-properties-dynamically-in-php
hah! You are correct. Thought about it a bit more, and realized what the underlying problem was. ME! Trying to do something completely un-necessary, but works now.
1-6 of 6