- Issue created by @volkerk
- @volkerk opened merge request.
- First commit to issue fork.
- 🇮🇳India chetan 11
Hi @volkerk
I have fixed all the phpcs isssue & attaching the patch for the same.
Please review this. - Status changed to Needs review
over 1 year ago 1:17pm 19 September 2023 - First commit to issue fork.
- 🇩🇪Germany osopolar 🇩🇪 GER 🌐
--- a/src/Plugin/Field/FieldType/BridtvReferenceItem.php
+++ b/src/Plugin/Field/FieldType/BridtvReferenceItem.php
@@ -124,8 +124,8 @@ class BridtvReferenceItem extends EntityReferenceItem implements BridtvVideoItem
*/
public function setValue($values, $notify = TRUE) {
if (isset($values['settings']) && is_string($values['settings'])) {
- // Unserialize the values.
- $values['settings'] = unserialize($values['settings']);
+ // Use json_decode to safely deserialize the values.
+ $values['settings'] = json_decode($values['settings'], TRUE);
}
parent::setValue($values, $notify);
}
Maybe \Drupal\bridtv\BridSync::syncVideoData() should pass the json_decoded value to setValue()? I wonder why there is a call to unserialize(), could it be related to how settings are stored (as serialized value)?
@chetan11 Why did you remove the $this->t() calls? That does not seem to be something phpcs complains about, does it?
There are other issues with phpcs which where not addressed we may fix too.