Issue fork bridtv-3387266

Command icon 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

volkerk created an issue. See original summary.

volkerk’s picture

volkerk’s picture

volkerk’s picture

shagel made their first commit to this issue’s fork.

chetan 11’s picture

Hi @volkerk
I have fixed all the phpcs isssue & attaching the patch for the same.
Please review this.

chetan 11’s picture

Status: Active » Needs review

osopolar made their first commit to this issue’s fork.

osopolar’s picture

--- 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.

osopolar’s picture

Status: Needs review » Needs work