Fix array casting with DOM elements

This commit is contained in:
Andy Miller
2017-12-11 13:17:03 -07:00
parent 255f2f1db6
commit b5f75acf50
2 changed files with 3 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ class Excerpts
foreach ($images as $image) {
$attributes = [];
foreach ((array)$image->attributes as $name => $value) {
foreach ($image->attributes as $name => $value) {
$attributes[$name] = $value->value;
}
$excerpt = [
@@ -88,7 +88,7 @@ class Excerpts
$html = '<'.$element['name'];
if (isset($element['attributes'])) {
foreach ((array)$element['attributes'] as $name => $value) {
foreach ($element['attributes'] as $name => $value) {
if ($value === null) {
continue;
}

View File

@@ -206,7 +206,7 @@ class Truncator {
private static function innerHTML($element) {
$innerHTML = '';
$children = $element->childNodes;
foreach ((array)$children as $child)
foreach ($children as $child)
{
$tmp_dom = new DOMDocument();
$tmp_dom->appendChild($tmp_dom->importNode($child, true));