Merge pull request #10069 from annando/notice-fatal
Avoid fatal errors and notices
This commit is contained in:
commit
b94f442dd8
2 changed files with 25 additions and 15 deletions
|
@ -541,7 +541,12 @@ class Image
|
||||||
do {
|
do {
|
||||||
// FIXME - implement horizontal bias for scaling as in following GD functions
|
// FIXME - implement horizontal bias for scaling as in following GD functions
|
||||||
// to allow very tall images to be constrained only horizontally.
|
// to allow very tall images to be constrained only horizontally.
|
||||||
|
try {
|
||||||
$this->image->scaleImage($dest_width, $dest_height);
|
$this->image->scaleImage($dest_width, $dest_height);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Imagick couldn't use the data
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} while ($this->image->nextImage());
|
} while ($this->image->nextImage());
|
||||||
|
|
||||||
// These may not be necessary anymore
|
// These may not be necessary anymore
|
||||||
|
|
|
@ -512,8 +512,10 @@ class ParseUrl
|
||||||
{
|
{
|
||||||
if (!empty($siteinfo['images'])) {
|
if (!empty($siteinfo['images'])) {
|
||||||
array_walk($siteinfo['images'], function (&$image) use ($page_url) {
|
array_walk($siteinfo['images'], function (&$image) use ($page_url) {
|
||||||
|
$image = [];
|
||||||
// According to the specifications someone could place a picture url into the content field as well.
|
// According to the specifications someone could place a picture url into the content field as well.
|
||||||
// But this doesn't seem to happen in the wild, so we don't cover it here.
|
// But this doesn't seem to happen in the wild, so we don't cover it here.
|
||||||
|
if (!empty($image['url'])) {
|
||||||
$image['url'] = self::completeUrl($image['url'], $page_url);
|
$image['url'] = self::completeUrl($image['url'], $page_url);
|
||||||
$photodata = Images::getInfoFromURLCached($image['url']);
|
$photodata = Images::getInfoFromURLCached($image['url']);
|
||||||
if (!empty($photodata) && ($photodata[0] > 50) && ($photodata[1] > 50)) {
|
if (!empty($photodata) && ($photodata[0] > 50) && ($photodata[1] > 50)) {
|
||||||
|
@ -523,8 +525,7 @@ class ParseUrl
|
||||||
$image['contenttype'] = $photodata['mime'];
|
$image['contenttype'] = $photodata['mime'];
|
||||||
unset($image['url']);
|
unset($image['url']);
|
||||||
ksort($image);
|
ksort($image);
|
||||||
} else {
|
}
|
||||||
$image = [];
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -542,7 +543,7 @@ class ParseUrl
|
||||||
if (!empty($media[$field])) {
|
if (!empty($media[$field])) {
|
||||||
$media[$field] = self::completeUrl($media[$field], $page_url);
|
$media[$field] = self::completeUrl($media[$field], $page_url);
|
||||||
$type = self::getContentType($media[$field]);
|
$type = self::getContentType($media[$field]);
|
||||||
if ($type[0] == 'text') {
|
if (($type[0] ?? '') == 'text') {
|
||||||
if ($field == 'embed') {
|
if ($field == 'embed') {
|
||||||
$embed = $media[$field];
|
$embed = $media[$field];
|
||||||
} else {
|
} else {
|
||||||
|
@ -685,8 +686,10 @@ class ParseUrl
|
||||||
{
|
{
|
||||||
if (!empty($jsonld['@graph']) && is_array($jsonld['@graph'])) {
|
if (!empty($jsonld['@graph']) && is_array($jsonld['@graph'])) {
|
||||||
foreach ($jsonld['@graph'] as $part) {
|
foreach ($jsonld['@graph'] as $part) {
|
||||||
|
if (!empty($part)) {
|
||||||
$siteinfo = self::parseParts($siteinfo, $part);
|
$siteinfo = self::parseParts($siteinfo, $part);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} elseif (!empty($jsonld['@type'])) {
|
} elseif (!empty($jsonld['@type'])) {
|
||||||
$siteinfo = self::parseJsonLd($siteinfo, $jsonld);
|
$siteinfo = self::parseJsonLd($siteinfo, $jsonld);
|
||||||
} elseif (!empty($jsonld)) {
|
} elseif (!empty($jsonld)) {
|
||||||
|
@ -699,10 +702,12 @@ class ParseUrl
|
||||||
}
|
}
|
||||||
if ($numeric_keys) {
|
if ($numeric_keys) {
|
||||||
foreach ($jsonld as $part) {
|
foreach ($jsonld as $part) {
|
||||||
|
if (!empty($part)) {
|
||||||
$siteinfo = self::parseParts($siteinfo, $part);
|
$siteinfo = self::parseParts($siteinfo, $part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
array_walk_recursive($siteinfo, function (&$element) {
|
array_walk_recursive($siteinfo, function (&$element) {
|
||||||
if (is_string($element)) {
|
if (is_string($element)) {
|
||||||
|
|
Loading…
Reference in a new issue