evolution-cms / evolution

Welcome to the new evolution of MODX Evolution!
GNU General Public License v3.0
261 stars 95 forks source link

Add 'document' as content type in case if it's defaulted due to plugin error #2127

Closed elcreator closed 1 year ago

elcreator commented 1 year ago

is_scalar is not enough validation as it not checks for empty value.

Way to reproduce the original issue - insert table with i.e. 200 rows to the multiTv input, with 7 text inputs (columns) in multiTV and save. It will not fail if you create 20 not 200 records it will save successfully, otherwise $content['type'] becomes empty and document loses Published status

elcreator commented 1 year ago

image For everyone concerned about reality of this scenario and why it's should be fixed here and not only at MultiTV module/snippet level: The way PHP limits extra fields (by default every field after first 1000) is just by removing them from $_POST array https://www.php.net/manual/en/info.configuration.php#ini.max-input-vars I.e. if snippet/plugin/module uses more than max-input-vars fields in the POST, this variable (and not only this one but also "published" etc) becomes empty.