I installed yesterday's dev snapshot to work around #2780573, and since then file uploads on the form result in a fatal error.
The message it get is:
PHP message: Uncaught PHP Exception 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." at /path/to/drupal/core/lib/Drupal/Core/Database/Connection.php line 1425" while reading response header from upstr
I'm wondering if there's some debug code in there somewhere or maybe something else.
My form definition is:
society:
'#type': textfield
'#title': Society
'#description': 'Name of Society.'
'#maxlength': '255'
'#placeholder': 'eg Albany Historical Society'
'#required': true
'#autocomplete_existing': true
contact_information:
'#type': container
'#title': 'Contact Information'
'#description': 'Details of person submitting news item.'
name:
'#type': textfield
'#title': Name
'#placeholder': 'eg John Smith'
'#required': true
email:
'#type': email
'#title': Email
'#placeholder': 'eg user@example.org'
'#required': true
phone:
'#type': tel
'#title': Phone
'#required': true
title:
'#type': textfield
'#title': Title
'#description': 'A short description of the news article'
'#title_display': before
'#placeholder': 'eg Our society is hosting an exhibition on local history'
'#required': true
news_article:
'#type': text_format
'#title': 'News Article'
'#description': 'News item details'
'#required': true
'#format': restricted_html
'#allowed_formats':
restricted_html: restricted_html
'#hide_help': 1
'#attributes':
class: clearfix
image:
'#type': managed_file
'#title': Image
'#description': 'Select an image to associate with your article.'
'#max_filesize': '2'
'#file_extensions': 'gif jpg png pdf'
captcha:
'#type': captcha
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screen Shot 2016-08-11 at 10.55.05 PM.png | 537.75 KB | jrockowitz |
Comments
Comment #2
kehan commentedI just checked both dev and 8.x-1.0-beta12 affected by this.
Comment #3
jrockowitz commentedYep, I am familiar with this type of issue.
Here is the exact error message.
I think the same issue is happening with #2782083: YAML Form disables ajax usage on media entity field.
Below is a screenshot confirming that I can duplicate the issue when I click remove on /yamlform/example_elements/test
Comment #4
jrockowitz commentedI am going to fix this ASAP and push a new release.
Comment #6
jrockowitz commentedThis regression was caused by the below code in \Drupal\yamlform\Plugin\YamlFormElement\TextFormat which was part of #2771749: Support text_format's allowed formats
The
$thisreference in #afterBuild serialized the TextFormat YamlFormElement plugin.Changing the afterBuild callback to use a static method solves the problem...
This regression was introduction on July 23, 2016 and included in the 8.x-1.0-beta10 release
Comment #7
jrockowitz commentedSince this issue was critical and very easy to fix and document. I push a new release.
@kehan Please confirm that your form is working as expected.
https://www.drupal.org/project/yamlform/releases/8.x-1.0-beta13