Problem/Motivation
Deprecated function: Creation of dynamic property Drupal\autosave_form\Form\AutosaveFormBuilder::$_serviceId is deprecated in Drupal\Component\DependencyInjection\Container->createService() (line 285 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal\Component\DependencyInjection\Container->createService(Array, 'form_builder') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('form_builder') (Line: 640)Steps to reproduce
Install it and view a page with the autosave form on PHP 8.2
Proposed resolution
Add
/**
* The service ID
*
* @var string
*/
public $_serviceId = 'autosave_form.form_builder';
to AutosaveFormBuilder.php
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | fix-php82-deprecation-3355495-19.patch | 1.95 KB | finn lewis |
| autosave_form-dynamic-property-deprecation.patch | 452 bytes | stevenlafl |
Issue fork autosave_form-3355495
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
keshavv commentedReviewed the patch and tested it. Its working prefect. moving to RTCB.
Comment #5
vipin.mittal18As PHP 8.2 test cases failed, the status was changed to the correct one.
Comment #6
mlncn commentedThe test failures are not the result of this patch. Tests are failing on the unpatched dev branch already (and the released version of the module too).
The failures are different on the merge request because vipin.mittal18 added an absolutely necessary fix for the tests to run at all— changing the theme to Stark, rather than Classy which is not enabled. But that, and the general test failures, should probably be dealt with in a separate issue / patch.
The patch in stevenlafl's initial issue creation is correct and is ready to be committed as per keshav.k's review.
Comment #7
heddn+1 on RTBC.
Comment #8
hchonovBut this issue shouldn't be occurring after https://www.drupal.org/node/3292540 or am I missing something here?
Comment #9
heddnYou would think, yes. Perhaps there is something else going on that still injects that? I didn't dig into why or what is setting that property, but in 10.1 and PHP 8.2, that property is still getting set on a regular basis, or basically every page. The warnings are quite noisy.
Comment #10
arunkumark+1 RTBC. I have tested the patch with Drupal 10.0.5 it was working fine.
Comment #11
rollins commentedThe provided patch also working ok for me.
PHP 8.2
autosave_form 1.4.0
Drupal core 9.5.9
Comment #12
santhosh@21 commentedThe reviewed patch also works for me
php - 8.2
drupal - 10.2
autosave_form - 1.4
Comment #13
adamevertsson commented3 x RTBC. Could this be implemented in a stable release, I wonder?
Comment #14
finn lewisAny chance of a release to include this?
Comment #15
mglamanThe issue is due to the decorated service.
#2896993: Decorated services crash on serialization. was fixed in 9.4.x, and #2531564: Fix leaky and brittle container serialization solution in 9.5. We can remove the workaround and change
core_version_requirementtocore_version_requirement: ^9.5 || ^10Comment #17
mglamanSee https://www.drupal.org/project/autosave_form/issues/3355495
Comment #18
smulvih2PR #12 worked for me, no longer seeing the deprecation error.
Comment #19
finn lewisAdding a patch file version of the merge request #12
https://git.drupalcode.org/project/autosave_form/-/merge_requests/12#not...
Comment #20
baluertlNecessary to be merged to let #3428200: Automated Drupal 11 compatibility fixes for autosave_form happen also.
Comment #21
bramdriesenWe're using this patch for quite some time now on a multitude of projects in production. Would be nice to see this land! RTBC+1
Comment #22
hchonovMerged. Thank you. This will be part of the 1.6 release.
Comment #23
hchonovComment #24
hchonovComment #25
bramdriesenDon't forget to close the other MR so it won't linger around. https://git.drupalcode.org/project/autosave_form/-/merge_requests/9
Comment #27
hchonovThanks for the remainder, @BramDriesen :)