Recent Topics

1 Mar 13, 2018 20:36    

Steps to reproduce:

  1. On the demo site go to the plugins settings page for any blog:
    http://demo2.b2evolution.net/stable/admin.php?ctrl=coll_settings&tab=plugins&action=edit&blog=1
  2. Expand Short Links.
  3. See several of the checkboxes have been checked.
  4. Click "Save Changes!"
  5. Expand Short Links.
  6. All the checkboxes are unchecked

Trying to update any of the boxes results in all the boxes being unchecked.
I'm also seeing this behaviour on my 6.9.7-stable version.

(where's the preview button gone, not sure my markdown is all correct!)

2 Mar 14, 2018 23:39

I've been looking at this issue and think I have found the cause of the problem.
The /plugins/shortlinks_plugin/_shortlinks.plugin.php page stores its plugin settings using a checklist type.

This looks like a half-implemented feature! Reading the checklist type from the database expects a PHP serialised key-value array. Saving the checklist type resets the array of new options to null, in CollectionSettings->set( $col_key1, $col_key2, $value ) because it passes the checklist array to utf8_substr() which returns null. So "" is saved to the database for plugin<id>_link_types. Once "" is saved into the database there is no object to de-serialise and so all the options are blank. It looks like it works at the beginning because there is no corresponding link_types record in the databases and the defaults are used.

There are 2 ways to fix this:

  1. Replace the checklist type with a number of checkbox types (same solution as the markdown plugin and all the others).
    2) In file /inc/plugins/_plugin.funcs.php:
    if( isset($parmeta['type']) && strpos( $parmeta['type'], 'array' ) === 0 )
    { // make keys (__key__) in arrays unique and remove them
        handle_array_keys_in_plugin_settings($l_value);
    }

        // --------------- XXX catch special case for checklist ---------------
    if( isset($parmeta['type']) && strpos( $parmeta['type'], 'checklist' ) === 0 )
    { // serialize array:
        $l_value = serialize($l_value);
    }

    if( isset( $parmeta['type'] ) && $parmeta['type'] == 'integer' )
    {   // Convert to correct integer value:

This converts the array into a serialised string so that it can be safely saved as normal. It feels a bit like a hack so maybe you can think of a better place to put the code that prepares the checklist data type for saving.

4 Mar 23, 2018 16:00

Sorry for the delay. Thanks for a link to the commit. I've switched on "watching all conversations" on GitHub, so I think that'll let me know about new commits.

I really wish there was a bit more help for developers. The documentation should contain at least something about the source, something like what the maze of branches are for or which branch to branch from when trying to submit patches. It just seems unnecessarily complicated to get up and running. It would also seem that the best way to install b2e is by cloning the github repo and not from a zip file, blending in unreleased patches released at different times with your own fixes is a nightmare. Oh, I can feel a rant coming on so maybe I'll blog about that instead ;)

In real life I'm a Java Dev and use Eclipse all the time so when they released Eclipse PDT it was the logical option and it's brilliant for both languages; I hear their C++ environment is coming along nicely. They all work in the same way and link with xdebug etc. The refactoring tools are great for Java but getting better for PHP. Anyway check it out.

https://www.eclipse.org/pdt/
http://www.bigsoft.co.uk/blog/index.php/2014/10/21/debugging-php-in-eclipse

This post has 4 feedbacks awaiting moderation...


Form is loading...