Closed (duplicate)
Project:
Webform
Version:
6.2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 May 2022 at 00:50 UTC
Updated:
17 May 2022 at 00:55 UTC
Jump to comment: Most recent
500 error at webform after upgrading Honeypot from 2.0.2 to 2.1.0.
Note that Honeypot has moved its procedural functions (honeypot_add_form_protection(), etc.) to a service in the new 2.1.0 release. The old procedural functions still exist, but they are deprecated and are simply wrappers for the new service. This is the only change in 2.1.0 that is likely to be the source of this problem.
Comments
Comment #2
sacredfox commentedThe following error log is recorded:
LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. (/var/www/drupal_composer/web/core/lib/Drupal/Core/Database/Connection.php の 1993 行目 Drupal\Core\Database\Connection->__sleep() 内)Unlike issue 3279371, cache rebuild did not work for my case.
Also, when I tried to send a message as a logged-in user of that site, it worked without any problem.
Comment #3
tr commentedThe
ServiceNotFoundExceptionfrom that other issue is unrelated.What version of Drupal core are you using? What version of Webform? Do you have a full stack trace?
I don't use Webform, so I don't have an easy way to try to reproduce this. It seems that Webform does a lot of things internally when integrating with Honeypot, and I don't know anything about the Webform internals. Searching for this error, it does seem that Webform has seen this problem before, so they may have a better idea of where to look for the source of this problem.
I don't see how the 'honeypot' service would get serialized, and that's the only place that the Honeypot module has a reference to the database connection.
I've added some information to the issue summary and I'm going to move this problem to the Webform queue - maybe someone over there can provide guidance.
Comment #4
sacredfox commentedI'm using Drupal core 9.3.12 and Webform 6.1.3 from composer.
No. I checked both Apache's error log and Drupal's log, but there was no other info except for that I have quoted in comment #2.
Comment #5
slangston commentedSame issue here.
D 9.3.12
P 7.4.29
Maria 10.3.27
Webform 6.1.3
Email is sent, but get that error. Went back to previous honeypot, hard refresh and works fine.
5/11/2022: Ping.
Still getting this error. Any ideas on how to fix it?
LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\Core\Database\Connection->__sleep() (line 1993 of core/lib/Drupal/Core/Database/Connection.php).
serialize(Array) (Line: 14)
Drupal\Component\Serialization\PhpSerialize::encode(Array) (Line: 111).....
Comment #6
cmlaraI haven't thrown this into a lab to 100% confirm however a cursory look at the code indicates this would be the most likely location where the HoneyPot service becomes a part of the form. After that it just requires the form to be serialized for some reason (in my experience forms being serialized is not too uncommon even outside of webform)
$this being an initialized honeypot service object. Back in 2.0.x and before this callback is to a global function where there is no class to serialize.
Moving this back to Honeypot project queue as there are two reports that just changing the installed version of Honeypot resolves the issue.
Comment #7
tr commentedI moved this to the Webform queue so I could get some advice from the Webform people who have seen this before with other integrations (search the queue), and to raise awareness there that Honeypot is now using a service so Webform's integration with Honeypot will eventually have to be updated.
The fix does probably have to come in Honeypot but it seems the quickest way to get a resolution is to have the Webform people weigh in on this.
Comment #8
cilefen commentedHello,
I am trying to reproduce this. What are the precise steps to reproduce? The issue title says "anonymous user" but the description omits that.
Comment #9
sacredfox commentedAh, it was my mistake. I missed mentioning it in the description.
In my environment, the issue occurred only when I was logged out from that drupal site, but did not happen when I was logged in as an admin user.
I guess it was just because Honeypot was not working when I was logged in as an admin.
Comment #10
othermachines commentedWe are also experiencing this with webform 6.1.3, honeypot 2.1.0 and Drupal 9.2.18. Rolling honeypot module back to 2.0.1 resolved it.
We were alerted to it when our users reported receiving an alert "File upload in progress. Uploaded file may be lost." when attempting to submit a webform with a required "Document file" field. Clicking "OK" on the alert resulted in a form error on the managed file field. When we looked at our PHP logs, we found the LogicException error.
Perhaps there are two separate issues here, but they both went away when I rolled back the honeypot module.
If I can provide any more info, let me know.
Edit: Adding webform version.
Comment #11
cilefen commentedIt seems like honeypot 2.1.0 should have been honeypot 3.0.0 because 2.1.0 broke backward compatibility.
Comment #12
bart lambert commentedSame issue Here.
D9.1.12
honeypot 2.1.0
webform 6.1.3
unknowinly entered as duplicate under honeypot issue
https://www.drupal.org/project/honeypot/issues/3279485
Comment #13
cilefen commentedI am still lost as to why this is like a bug for Webform to solve when it is honeypot that broke BC in a minor release.
Comment #14
cmlaraI believe the maianitner is looking for advice from Webform maintainers on how to allow the service to be serialized by the core Form API.
Honestly I think this issue should be in Honeypot and maybe the maintainer could open a support request issue in webform for advice if they require it.
The initial bug report includes one option using the DependencySerializationTrait to solve the issue.
Comment #15
cilefen commentedComment #16
cmlaraLinking an issue in Honeypot queue that has one patch attempt already.
Comment #17
tr commented@cilefen, this was most certainly NOT a BC breaking change. The Honeypot API was not changed. Some procedural functions were PROPERLY deprecated in the minor point release, which is explicitly allowed. Core does that all the time.
Comment #18
cilefen commentedAnd yet it broke Webform, and Core, according to the related issue. You can follow all the rules and still break BC.
Comment #19
cilefen commentedIt looks as though the fix will be to honeypot.