redux-framework icon indicating copy to clipboard operation
redux-framework copied to clipboard

Sorter integer keys get overwritten

Open devgrok opened this issue 11 years ago • 2 comments

Same issue as https://github.com/reduxframework/redux-framework/pull/1146

When having an integer as the key, after resetting, editing, saving, reloading page - the key now becomes a lowercase version of the value. i.e. key=value

//initial default: 
array(13 = 'Title')
//after edit/save  
array('title' = 'Title')
array(
    'id'        => 'opt-homepage-layout',
    'type'      => 'sorter',
    'title'     => 'Layout Manager Advanced',
    'subtitle'  => 'You can add multiple drop areas or columns.',
    'compiler'  => 'true',
    'data'      => array('disabled'=>'posts'),
    'options'   =>  array(
        'enabled'   => array(),
        'disabled'  => array(),
    ),
),

So any data type where the key is an integer (id field) will have this problem. e.g. post, page, term.

Using the pull request as a guide, I tried using array_replace instead of array_merge as it treats them all as key/value pairs instead of index/value however that didnt seem to work. The only change I could get to work was by patching it to prefix the key. I'll submit a patch for those after that feature.

Pull request to add prefix to key: https://github.com/reduxframework/redux-framework/pull/2428

devgrok avatar Jun 21 '15 14:06 devgrok

That's fine, but we have a VERY strict policy about break backwards compatibility. Please make sure any pull request does not do so. It's been a problem as of late. :)

kprovance avatar Jun 21 '15 19:06 kprovance

Addressed in Redux 4.

kprovance avatar Jul 07 '18 07:07 kprovance