symphonycms/symphony-2 — Issue #879: Allow processRawFieldData to return a $message
Author: brendo
Created: 2011-11-07 04:29:52+00:00
State: open
Labels: confirmed

This bug has existed since 2008 and I think will allow some better error messages for fields. In fact, I think this limitation was discovered when building the Members extension by @michael-e but I never noticed to subtle bug.

Inside the `Entry->setDataFromPost` method lies [this line](https://github.com/symphonycms/symphony-2/blob/master/symphony/lib/toolkit/class.entry.php#L183), which essentially logs an error message against a `field_id`. If something goes wrong in the `processRawFieldData` function, [these lines](https://github.com/symphonycms/symphony-2/blob/master/symphony/content/content.publish.php#L611-612) are meant to display the error message.

The problem is that `$m` is never set, so the error message will always be `There was a problem rendering this page. Please check the activity log for more details.`!!

I think the new signature for `processRawFieldData` needs to be updated to mostly mirror `checkPostFieldData($data, &$message, $entry_id = null)`. Therefore `processRawFieldData($data, &$status, $simulate=false, $entry_id=null)` would become `processRawFieldData($data, &$status, &$message, $simulate=false, $entry_id=null)`.

This is breaking API change, but I feel it's better in the long run than `processRawFieldData($data, &$status, $simulate=false, $entry_id=null, &$message)`. It will land in 2.3 for this reason.