Skip to content

Commit

Permalink
automatically instantiate attributes using php class names
Browse files Browse the repository at this point in the history
  • Loading branch information
mauri870 committed May 5, 2022
1 parent 9844bc8 commit c6c5dd3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Purifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ private function addCustomAttributes(array $attributes, HTMLPurifier_HTMLDefinit
}

continue;
}
}

if (class_exists($validValues)) {

This comment has been minimized.

Copy link
@mauri870

mauri870 Nov 14, 2022

Author Contributor

Good catch, it is missing a check if the value is a string.

$validValues = new $validValues();
}

$definition->addAttribute($onElement, $attrName, $validValues);
}
Expand Down

1 comment on commit c6c5dd3

@hasnat-we
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mewebstudio Hi, we got several error due to this change:
class_exists() expects parameter 1 to be string, object given.
Even though we are passing $post->content which is supposed always string or null.

Please sign in to comment.