Skip Navigation

[Resolved] PHP Warning: Illegal string offset ‘form_id’

This thread is resolved. Here is a description of the problem and solution.

Problem:
When you insert cred-form-message ShortCode in a Page styled by Beaver Builder (PRO) the ShortCode will produce a PHP Warning:
PHP Warning: Illegal string offset 'form_id' in .../cred-frontend-editor/application/models/shortcode/form/message.php on line 33

Solution:
Update Toolset

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 9 replies, has 2 voices.

Last updated by Beda 6 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#1116077

I am trying to:
Remove the error

Link to a page where the issue can be seen:
hidden link

Is this a Php version issue or Page builder issue? I have beaver builder plugin installed on the site

#1116079

The line of code with the error is preceded by this comment:
his will return nothing if the URL parameter cred_referrer_form_id is missing or empty

It is the code that should display the success message of a submitted form, which here is not happening as the URL has no such url parameter.

The illegal string offset would refer to something like $atts[form_id] == '' instead of $atts['form_id'] == '' , but when I control the code of my actual copy of Toolset Forms, this is exactly what I see, so it cannot be that it would throw an illegal offset.

Could you try this?
- remove the current Toolset Forms
- replace it with a fresh download from here: https://toolset.com/account/downloads/

If then the issue persists, please let me know the exact steps to reach it.
Technically, the code should not be able to throw that error.

#1117425

The issue still perists I removed the current toolset forms plugin and downloaded a new one and installed it's still having an error.

#1117582

Thanks
As mentioned here, https://toolset.com/forums/topic/warning-illegal-string-offset-form_id/#post-1116079, I would need to have some steps, because Technically, the code should not be able to throw that error.

You can also attach a copy of the site, however without steps I will not be able to either replicate or see the issue, I would need to know how/what you did before this issue happens and where/how I could see to replicate it.

Could you provide such steps or instructions?

In case it's needed, I added a private reply that will allow you to share data privately with us, inclusive Duplicator packages made according to this guide:
https://toolset.com/faq/provide-supporters-copy-site/

Interestingly there is only one other report with this exact error:
https://toolset.com/forums/topic/illegal-string-offset-in-message-dot-php-on-line-33/

If you are using the "Classifieds" site or any of its structure or any of its plugins then this is due to something else, namely a Form, or View, that was present in the Classifieds Install but has been removed.

This is why the user here was able to solve this on a clean copy of the Classifieds install:
https://toolset.com/forums/topic/illegal-string-offset-in-message-dot-php-on-line-33/#post-1114087

It's because the Form ID now exists again.
There are some similar ones when you start to delete things from the classifieds site or "break it down":

( ! ) Warning: Illegal string offset 'get' in .../plugins/toolset-classifieds/inc/toolset-classifieds.class.php on line 528

We plan to remove and eventually substitute Toolset Classifieds plugin with something better, it will be removed in future or rewritten.

I suspect the issues are due to this scenario, however if not please use the next reply to add more details so I can help

#1118914

In the problematic page, you inserted the ShortCode "[cred-form-message]".

This is to be used when the following is true:

Forms can redirect to the edited post, or to a specific page after they are submitted.
The ShortCode [cred-form-message] can be added to the redirect target to display the success message from the form that just redirected there.

This means you need a form to redirect somewhere, to have a Success Message, and then you can place that ShortCode on that target.

On that page, there are additionally 3 Toolset Forms and a few Views (after removing all the non-Toolset content and ShortCodes)

At this point the issue was still visible, but I started seeing several errors due to a cache plugin as this example on top of it:
( ! ) Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /plugins/sg-cachepress/class-sg-cachepress-supercacher.php on line 104

I disabled all plugins and the Theme, and the issue was gone.
I re-enabled the Child Theme of Beaver, which did not provoke the problem
I then activated a few plugins, and it came back.

Please always deploy the websites you have issues with to a testing server, where you can deactivate the plugins one by one, and change the theme.
Then, the conflicting plugin can be pinpointed by reactivating them one by one or in groups.

This then allows you to provide us with this information and we can solve it.

The problem Plugin, in this case, is Beaver Builder Plugin (Pro Version)

I have only confirmed this on your copy of the site, not on a clean install, and I was as well able to resolve this issue by removing other parts of the page without disabling that plugin.
Those parts are the views, that load a massive list of what seems forms, however, the content of the builder, if disabled, gets so messed up that it's not possible to tell what exactly was setup how.

I will escalate this for further analysis (by myself) where I'll try to find the precise steps to replicate this if you have any hints, they are welcome so I can prepare a report fo the developers.

As soon I am able to do that, they can fix the problem.

It seems due to this form BTW:
[cred_user_form form="edit-user-account-details"]

I was not yet able to see why - but I see it redirects to the same page, where we also expect a success message displayed, so that may be the conflict here.

#1126830

I have found the steps and solution.
You can either add form_id="18" to the [cred-form-message] (where "18" should be the ID of the form of which the success message should be displayed), or, you can wait for the update that will solve this.
(I suppose you cannot stop using Beaver Builder, which also would stop the issue from happening).

The issue can be even replicated without any other plugin, just Toolset forms, so we will solve this as a bug in Toolset Form's next release(s).

I will keep you updated here.

#1128097

This will be solved in Forms 2.1.2 for which I have no ETA but you can follow the changelog and blog posts, as well as you will get a push notification on the Updates area of Plugins in your WordPress to update.

Thanks for the report!

#1141972

2.1.2 is released now, please can you update and feedback whether the issue is solved for you as well?

#1142139

I put the shortcode [cred-form-message] directly and the error is not appearing anymore. I think the update fixed the issue. thanks

#1142214

Great, closing here.