lukaskleinschmidt / kirby-sortable

Making subpage managing a breeze
79 stars 6 forks source link

Error: mb_strpos(): Empty delimiter #49

Closed de4123 closed 6 years ago

de4123 commented 6 years ago

If I use "kirby-sortable" on my website I get the error "mb_strpos(): Empty delimiter" when I want to add a new module in the contentarea (cf. screens). I am using PHP 7.1. You can see the parameters in the screenshot. Is there any solution? I dont know what to do. On my local Mamp-Server everything works fine. Thanks for help a lot!

Screens:

kirby-use-of-plugin-sortable-1 kirby-use-of-plugin-sortable-errorview serverparameters
lukaskleinschmidt commented 6 years ago

Thats wierd. I have no idea right now. The only thing suspicious is that magic_quotes_gpc is set to true. magic_quotes are deprecated since PHP 5.4 and I think you should not have this option when using PHP > 5.4 (e.g 7).

Are you sure you run PHP 7 on your live server?

de4123 commented 6 years ago

Yes, I am running PHP 7 on my live server. I disabled "magic_quotes_gpc" but the error is still there. Its pitty because your plugin is really great. Maybe anybody else has any idea?

lukaskleinschmidt commented 6 years ago

Can you confirm that your mbstring extension is working as expected? What version of mbstring is currently installed?

de4123 commented 6 years ago

Hello Lukas,

thanks for this hint! I guess the extension was not working properly, because the value of "mbstring.func_overload" was "7". I tested now the extension "mbstring.func_overload" with all possible adjustments for the value 0-7:

value of mbstring.func_overload


0 - Plugin "sortable" is working 1 - Plugin "sortable" is working 2 - Plugin "sortable" is not working 3 - Plugin "sortable" is not working 4 - Plugin "sortable" is working 5 - Plugin "sortable" is working 6 - Plugin "sortable" is not working 7 - Plugin "sortable" is not working

Now I have choosen the value "5" and the plugin works fine! I guess it depends on the needed function which has to be overload in your plugin?

I found this: https://secure.php.net/mbstring.overload

I attach you also my server-adjustments. Maybe you can fix the problem or give an advise in the installation-guide?

Thanks a lot! Doreen

bildschirmfoto 2018-06-01 um 11 14 22
lukaskleinschmidt commented 6 years ago

I would advise to stick with the default values for the mbstring configuration. It can lead to a bunch of unexpected behaviour all over the place. So setting mbstring.func_overload to 0 would be the wise thing to to.

But I can't tell if anything running on your server requires mbstring.func_overload = 7 to work properly. If this is a "fresh" server than this is in my opinion a strange base configuration.

To finish this one off. The configuration / problem is not limited to my plugin. This is nothing I can prevent in the first place beacause I can't or should change the server config here. I think I just got unlucky because the plugin throwed a somewhat usefull error :wink:

I will consider adding something to the docs though.

lukaskleinschmidt commented 6 years ago

@de4123 out of curiosity. Do you use the plugin together with the modules-plugin? If so do use a different prefix than module.

If you use it witout the modules-plguin what is the value set for prefix in your blueprint if any?

de4123 commented 6 years ago

Yes, I use the plugin with "modules-plugin" together. For prefix I have set "null" but for "parent" I have set "modules".

This is my blueprint for the full-width-layout:


title: Layout volle Seitenbreite

pages: template:

fields: title: label: Titel type: text

headertitle: label: Headertitel type: text

subtitle: label: Untertitel type: text

sortable: label: Content-Elemente type: sortable

sortable: true

layout:  base
variant: null

limit: false

parent: modules
prefix: null

options:
  limit: false

The parent-folder is named with "modules" so your plugin is searching for content-elements in this folder. I attach you the folder-structure of my home-site. On my home-site I use the blueprint above.

Folder "1-home" with subfolder "modules" for the modules:


bildschirmfoto 2018-06-01 um 12 38 07

I hope I use your plugin in a correct way?

lukaskleinschmidt commented 6 years ago

Looks all fine. Just trying to understand the source of the error.