oc-responsive-images-plugin icon indicating copy to clipboard operation
oc-responsive-images-plugin copied to clipboard

Trying to get property 'type' of non-object in blog\models\Category.php:206

Open dathwa opened this issue 3 years ago • 0 comments

Hi. Plugin works fine in my non-blog site. Tried it in a site with the Rainlab Blog and see below.

run: php artisan responsive-images:generate

these 3 types are tripping it: blog-category, blog-post, category-blog-posts

so as a quick fix i've added on \offline\responsiveimages\classes\ImagePreloader.php(182)

$skips = ['blog-category', 'blog-post', 'category-blog-posts'];
if (!in_array($type, $skips))
{
      $urls = $urls->concat($this->getUrlsForItem($type, $itemName));
}

Can anyone help? Thank-you.

[2021-12-10 15:55:07] development.ERROR: ErrorException: Trying to get property 'type' of non-object in C:\htdocs\xxx\public_html\plugins\rainlab\blog\models\Category.php:206
Stack trace:
#0 C:\htdocs\xxx\public_html\plugins\rainlab\blog\models\Category.php(206): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Trying to get p...', 'C:\\htdocs\\aps.o...', 206, Array)
#1 C:\htdocs\xxx\public_html\plugins\rainlab\blog\Plugin.php(165): RainLab\Blog\Models\Category::resolveMenuItem('News Category', '///mspan', Object(Cms\Classes\Theme))
#2 C:\htdocs\xxx\public_html\vendor\october\rain\src\Events\Dispatcher.php(388): RainLab\Blog\Plugin->RainLab\Blog\{closure}('blog-category', 'News Category', '///mspan', Object(Cms\Classes\Theme))
#3 C:\htdocs\xxx\public_html\vendor\october\rain\src\Events\Dispatcher.php(234): October\Rain\Events\Dispatcher->October\Rain\Events\{closure}('pages.menuitem....', Array)
#4 C:\htdocs\xxx\public_html\vendor\october\rain\src\Events\Dispatcher.php(201): October\Rain\Events\Dispatcher->dispatch('pages.menuitem....', Array, false)
#5 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(261): October\Rain\Events\Dispatcher->fire('pages.menuitem....', Array)
#6 C:\htdocs\xxx\public_html\plugins\offline\responsiveimages\classes\ImagePreloader.php(201): Illuminate\Support\Facades\Facade::__callStatic('fire', Array)
#7 C:\htdocs\xxx\public_html\plugins\offline\responsiveimages\classes\ImagePreloader.php(182): OFFLINE\ResponsiveImages\Classes\ImagePreloader->getUrlsForItem('blog-category', 'News Category')
#8 [internal function]: OFFLINE\ResponsiveImages\Classes\ImagePreloader->OFFLINE\ResponsiveImages\Classes\{closure}(Array, 'blog-category')
#9 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Support\Collection.php(638): array_map(Object(Closure), Array, Array)
#10 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Support\Traits\EnumeratesValues.php(285): Illuminate\Support\Collection->map(Object(Closure))
#11 C:\htdocs\xxx\public_html\plugins\offline\responsiveimages\classes\ImagePreloader.php(187): Illuminate\Support\Collection->flatMap(Object(Closure))
#12 C:\htdocs\xxx\public_html\plugins\offline\responsiveimages\classes\ImagePreloader.php(48): OFFLINE\ResponsiveImages\Classes\ImagePreloader->getPageUrls(Object(October\Rain\Support\Collection))
#13 C:\htdocs\xxx\public_html\plugins\offline\responsiveimages\console\GenerateResizedImages.php(30): OFFLINE\ResponsiveImages\Classes\ImagePreloader->preload()
#14 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): OFFLINE\ResponsiveImages\Console\GenerateResizedImages->handle()
#15 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Container\Util.php(37): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#16 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#17 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(October\Rain\Foundation\Application), Array, Object(Closure))
#18 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Container\Container.php(590): Illuminate\Container\BoundMethod::call(Object(October\Rain\Foundation\Application), Array, Array, NULL)
#19 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Console\Command.php(134): Illuminate\Container\Container->call(Array)
#20 C:\htdocs\xxx\public_html\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#21 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Console\Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#22 C:\htdocs\xxx\public_html\vendor\symfony\console\Application.php(1009): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 C:\htdocs\xxx\public_html\vendor\symfony\console\Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OFFLINE\ResponsiveImages\Console\GenerateResizedImages), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 C:\htdocs\xxx\public_html\vendor\symfony\console\Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Console\Application.php(93): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 C:\htdocs\xxx\public_html\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(131): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 C:\htdocs\xxx\public_html\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 {main}  

dathwa avatar Dec 10 '21 16:12 dathwa