This issue cropped up in a CakePHP app but I think our problem is more related to something we don't understand about PHP. It seems invocation ofvia $this of a method in an associated class does not properly handle arguments by reference.
In a Bait controller class (BaitsController) a function foo from the Bait model class is invoked - $this is properly instantiated:
Code: Select all
function test()
{
Bait::foo($xxx); // works correctly
$this->Bait->foo($xxx); // does not work
}Code: Select all
function foo(&$msg)
{
$msg = "HOWDY DOODY";
}If you put function foo within the Bait controller class $this->foo() works fine. However if you put it in the model Class using the $this->Bait->foo() invocation syntax seems to ignore the parameter by reference although it does call the function. What's up with that?
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: