0 - Call to a member function get() on null

Phoca PDF - creating PDF documents in Joomla! CMS
frdt
Phoca Member
Phoca Member
Posts: 10
Joined: 28 Feb 2013, 10:31

0 - Call to a member function get() on null

Post by frdt »

Jooomla 3.9.14, php 7.2.23 , Template joomspirit 134
With this template ther are no icon.php under com_content then I put your code in editing file "/html/com_content/article/default.php" in template "joomspirit_134".
The code put is :

Code: Select all

$phocaPDF = false;
if (JPluginHelper::isEnabled('phocapdf', 'content')) {
include_once(JPATH_ADMINISTRATOR.'/components/com_phocapdf/helpers/phocapdf.php');
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($displayData['item'], $displayData['params']);
} 
and after

Code: Select all

<?php echo $phocaPDF; ?> 
as describe in your setup install

With this cutsomization I get : 0 - Call to a member function get() on null

I step by step comment line of added code and this line is responsible of the error : $phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($displayData['item'], $displayData['params']);

I also try the solution found on a another topic with the same error but this solution doesn't resolve the issue

In debug mode here are the result

Call to a member function get() on null
/var/www/fdth/data/www/scourmont.mes-services.biz/administrator/components/com_phocapdf/helpers/phocapdf.php:91
Call stack
# Function Location
1 () JROOT/administrator/components/com_phocapdf/helpers/phocapdf.php:91
2 PhocaPDFHelper::getPhocaPDFContentIcon() JROOT/templates/joomspirit_134/html/com_content/article/default.php:17
3 include() JROOT/libraries/src/MVC/View/HtmlView.php:701
4 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:230
5 Joomla\CMS\MVC\View\HtmlView->display() JROOT/components/com_content/views/article/view.html.php:210
6 ContentViewArticle->display() JROOT/libraries/src/Cache/Controller/ViewController.php:102
7 Joomla\CMS\Cache\Controller\ViewController->get() JROOT/libraries/src/MVC/Controller/BaseController.php:663
8 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/components/com_content/controller.php:118
9 ContentController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:710
10 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_content/content.php:43
11 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402
12 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377
13 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
14 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
15 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:196
16 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49

How to solve this ?
thx
frdt
Phoca Member
Phoca Member
Posts: 10
Joined: 28 Feb 2013, 10:31

Re: 0 - Call to a member function get() on null

Post by frdt »

the code to correct thi error is :

Code: Select all

$phocaPDF = '';
if (JPluginHelper::isEnabled('phocapdf', 'content')) {
    include_once(JPATH_ADMINISTRATOR . '/components/com_phocapdf/helpers/phocapdf.php');
    $phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($this->item, $params);
}
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: 0 - Call to a member function get() on null

Post by Jan »

Hi, thank you for the info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply