Bug #16221 Clarification Requested

autosave doesn’t work w/invalid data and can cause errors w/add ons….

Version: 2.2.1 Reporter: Robin Sowell

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

K- original issue had to do with Matrix and autosave- see P&T bug report:
https://getsatisfaction.com/pixelandtonic/topics/matrix_and_autosave

Using EE 2.2.1 I get the following error from Matrix when the autosave kicks in. Using Matrix 2.2.2.1.

Severity: Notice
Message: Undefined index: fields
Filename: matrix/ft.matrix.php
Line Number: 1823

...

The first occurrence I see of $this->cache[‘fields’] is in the validate function… I’m betting the autosave isn’t calling validate.

I was betting we didn’t call autosave either- because it meant a missing required field would result in no autosaved data.

However- we are validating autosaved data- _check_for_data_errors.  So I take a look at the ajax response after making a textarea required and not filling it in:

“success”:“Autosaved at 01:22 PM”,“autosave_entry_id”:{"Body":"The following field is required:"},“original_entry_id”:0}

Don’t let the success fool you- db is not being populated.

I suspect the matrix issue occurs because our internal ‘required’ check kicks in before field validation is ever run- but I won’t swear.

Just skipping the _check_for_data_errors() if autosave is true also causes errors in a quick test-

A PHP Error was encountered

Severity: Notice
Message:  A non well formed numeric value encountered
Filename: api/Api_channel_entries.php
Line Number: 140

Not that I’m at all sure that’s how we’d want to handle it anyway.

So- this one needs some thought- what if any validation do we need to run on autosaved data.  I really don’t think any- but obviously this is problematic at present.  Also- we need to keep the Matrix issue in mind- I think that may be better addressed on their end, but like ‘revisions’, we need to be careful of third party fields and how they may have things structured.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases