CakePHP 2: Indirect modification of overloaded property ... has no effect

Showing 1-3 of 3 messages
CakePHP 2: Indirect modification of overloaded property ... has no effect handsofaten 8/1/11 12:18 PM
Continuing to work through migrating to Cake2, I'm hitting this error.
The code would be something like:

$this->data['User']['password'] = AuthComponent::password($this-
>data['User']['password']);

The error:

Indirect modification of overloaded property UsersController::$data
has no effect

In another case, I try to unset a value in $this->data and get the
same error.

Can anyone help with this?

thanks
Re: CakePHP 2: Indirect modification of overloaded property ... has no effect José Lorenzo 8/1/11 12:36 PM
Please read the migration guide, $this->data is now just a ready-only to the new $this->request->data
Re: CakePHP 2: Indirect modification of overloaded property ... has no effect mark_story 8/2/11 9:35 AM
$this->data is only provided in the controller as BC way to read
data.  Using it to write data the way you're doing it will result in
angry PHP.  This is because of the way __get() works, in that it
returns read-only versions of the data it fetches.

You should be able to use the upgrade shell to update $this->data -->
$this->request->data.

-Mark