Problem/Motivation
After upgrading to the most recent version (8.x-1.22), my application is logging `This could not be unserialized` errors with '%value' equal to 'a:0:{}'. This seems to be caused by a 's:12:"dependencies";a:0:{}' pair being present in my metatag configuration values.
Steps to reproduce
Not sure on the exact reproduction; it has appeared after upgrading.
Version info
PHP 8.1.11
Drupal 9.4.7
Metatag 8.x-1.22
Proposed resolution
Allow deserialization of empty arrays without error logs where possible.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | metatag-n3313273-11.patch | 1.02 KB | damienmckenna |
| #8 | 3313273-8.patch | 1.19 KB | wells |
Comments
Comment #2
jnoordsij commentedComment #3
damienmckennaDoes the problem go away if you edit and re-save the global default settings?
Comment #4
jenger1965 commentedI have the same problem with lots of "This could not be unserialized: a:0:{}" error messages in the wd log.
Resaving of the global settings does not help.
In MetatagManger->getFieldTags(): An serialized empty array "a:0:{}" should be handled as empty string.
Not enter the
if (!empty($new_tags))pathComment #5
jenger1965 commented$new_tags = unserialize($serialized_value);can return FALSE if unserialize() fails.
Maybe it makes sense to differ between FALSE and an empty array at
if (!empty($new_tags)) {Comment #6
jenger1965 commentedThis patch work for me...
Comment #7
damienmckennaThanks for working out a possible patch, let's see how it works with the testbot.
Comment #8
wellsI'm also seeing this issue. The #6 patch had the wrong base. Attaching an updated patch here.
Comment #9
flocondetoileI saw too a lot of errors in the logs since I upgraded metatag to 8.x-1.22.
Patch #8 fix the issue.
Comment #10
othermachines commentedPatch #8 resolves the error for me (using metatag 8.x-1.22) - thanks!
Comment #11
damienmckennaThank you for the reviews.
This has a minor tidying of the changes.
Comment #13
damienmckennaCommitted. Thanks everyone!