Closed marc-farre closed 1 year ago
With version 2.0.0-beta.1, I often get:
Error: Call to a member function __toString() on null in /usr/www/humhub/protected/modules/linkpreview/controllers/IndexController.php:73 Stack trace: #0 /usr/www/humhub/protected/modules/linkpreview/controllers/IndexController.php(48): humhub\modules\linkpreview\controllers\IndexController->parseMetaImage() #1 [internal function]: humhub\modules\linkpreview\controllers\IndexController->actionFetch() #2 /usr/www/humhub/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array() #3 /usr/www/humhub/protected/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams() #4 /usr/www/humhub/protected/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction() #5 /usr/www/humhub/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction() #6 /usr/www/humhub/protected/vendor/yiisoft/yii2/base/Application.php(384): yii\web\Application->handleRequest() #7 /usr/www/humhub/index.php(25): yii\base\Application->run() #8 {main}
The bug is here:
$imageUrls = $info->getMetas()->get('og:image:url') ?: $info->getMetas()->get('og:image') ?: [$info->image->__toString()];
As $info->image can be null.
$info->image
@gevorgmansuryan I have the bug also line 56 of the same file for the same reason, for $info->image->__toString().
$info->image->__toString()
With version 2.0.0-beta.1, I often get:
The bug is here:
As
$info->image
can be null.