View Issue Details

IDProjectCategoryView StatusLast Update
0000138BwPostmanSubscribers Frontendpublic2023-05-02 12:39
Reporterdstreichert Assigned ToRomana  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.x 
Summary0000138: #0 Call to a member function getTable() on bool on index.php?option=com_bwpostman&view=register
DescriptionHello,
i become shown this error '#0 Call to a member function getTable() on bool' on page 'index.php?option=com_bwpostman&view=register'.
This is on the Joomla 3.9.28 .
I have a solution.
If running this patch on the file 'components\com_bwpostman\controllers\register.php'.
@@ -91,7 +91,8 @@
         // Check if user is logged (subscriber id = 0 means the user has no newsletter subscription)
         if ($userId)
         {
- $subsTable = $this->getModel('subscriber', 'Administrator')->getTable('Subscriber');
+ require_once(JPATH_ADMINISTRATOR . '/components/com_bwpostman/models/subscriber.php');
+ $subsTable = $this->getModel('subscriber')->getTable('Subscribers');
             $subscriberId = $subsTable->getSubscriberIdByUserId($userId);
         }
         // Check if user is in edit mode

Can you please fix this bug in future releases?
TagsPatch

Activities

Romana

2022-09-02 16:03

administrator   ~0000055

H Danny,
You can't be serious! You want me to insert a patch to a version, which was published over 3 years ago? There were a number of updates to BwPostman since then. I suggest, You do the updates, if needed one by one, I can't say if it is possible to do such a great version jump in one step.
Romana
P.S. Same applies to bug 0000139 reported by You.

dstreichert

2022-09-02 16:08

reporter   ~0000056

Hi Romana,
i have the BwPostman version 3.2.1 in use.
This ist not old or?

Romana

2022-09-02 16:15

administrator   ~0000057

Last edited: 2022-09-02 16:24

View 3 revisions

Hi Danny,
You selected version 2.3 at Your report and this is a really old one…
If You really use version 3.2.1 then it lacks of descriptions of how You get these errors, so that I can reproduce this error. Be ensured, BwPostman passes a great number of automated and manual tests before it is published. If I can reproduce the error reported, I can add a further test to prevent it for happen again.
Romana

Edit:
Principally my test suites run against the current version of Joomla, not against old ones!

dstreichert

2022-09-02 16:47

reporter   ~0000058

I have the Joomla version 3.9.28 , this is a current version. Of course I could also use version 4 of Joomla, but we don't want that yet and Joomla 3 will not expire until next year.
Yes I mean really the version 3.2.1 from BwPostman. On the bug report page of this MantisBT I can only select version 2.3 as there are no others available.
I wrote the error description for reproduction above:
I'm getting this error '#0 Call to a member function getTable() on bool' on page 'index.php?option=com_bwpostman&view=register' when I view the page.
And I've already written the solution, so it should be reproducible.

Romana

2022-09-02 23:37

administrator   ~0000059

Okay, 3.9.28 isn't very old, but it is old, current version is 3.10.11. I will see when I get the time to go back 1 year and 12 revisions of Joomla.

Romana

2022-09-06 11:10

administrator   ~0000061

I now have checked this with a fresh installation of Joomla! 3.9.28 and a therefore also fresh installation of BwPostman 3.2.1, then added my test data. With both the automated tests and the manual testing , I can't reproduce this error.

dstreichert

2022-09-06 11:24

reporter   ~0000062

I still get this error after upgrading to version 3.10.11.
The error message only appears if you are logged into the frontend and call up the 'index.php?option=com_bwpostman&view=register' page.

Romana

2022-09-06 13:56

administrator   ~0000063

Okay, I see, that at some special cases the Joomla auto loader can't find the needed model. The correct fix is to place the require_once at top of the class at the other require_once commands.
The next update of BwPostman will contain this fix.

dstreichert

2022-10-31 15:59

reporter   ~0000064

Hi Romana,
I now have BwPostman version 3.2.2 installed and Joomla version 3.10.11.
Unfortunately I still get the message: '#0 Call to a member function getTable() on bool'
The error is in line 95 of the file components\com_bwpostman\controllers\register.php
$subsTable = $this->getModel('subscriber', 'Administrator')->getTable('Subscriber');
The getModel function in the Joomla\CMS\MVC\Controller\BaseController class requires 'The class prefix' as the second parameter.
When calling the $this->getModel('subscriber', 'Administrator') function, the model with the name 'AdministratorSubscriber' is searched for, but it doesn't exist.
Instead, line 95 should contain:
$subsTable = $this->getModel('subscriber', 'BwPostmanModel')->getTable('Subscriber');
After changing the line, a second error is thrown:
#0 Call to a member function getSubscriberIdByUserId() on bool
The getTable function tries to find the BwPostmanTableSubscriber class, which does not exist.
Instead, line 95 should contain:
$subsTable = $this->getModel('subscriber', 'BwPostmanModel')->getTable('Subscribers');

Thank you very much

PS: Ich würde auch gerne in Deutsch schreiben.

Romana

2022-11-05 12:48

administrator   ~0000065

Hallo Danny,

dann von mir aus eben weiter auf deutsch.

Jepp, hast Du ganz richtig erkannt. Ich bin mit J3 nicht mehr so warm, da ist der Parameter für J4 rein gerutscht. Und wenn wir schon dabei sind, dann schreiben wir den ersten Parameter für das Model am Anfang auch groß, der Ordnung halber. ;-)

Ich muss wohl doch noch einen Test bauen, bei dem angemeldete Benutzer ein Abonnement erstellen wollen. :-(

Da Du der einzige bist, dem der Fehler über den Weg gelaufen ist und Du eine Lösung hast, werde ich mir mit der neuen Version Zeit lassen. Vielleicht findest Du ja noch was?

Liebe Grüße
Romana

TrackerBlaster

2022-11-26 01:45

reporter   ~0000072

Hi Romana,

I've to confirm the bug is there and I was NOT logged into the frontend, neither the backend.

BwPostman version 3.2.2 installed and Joomla version 3.10.11.

The suggested patch by Danny (dstreichert) is OK,
 that works, I've applied it and checked.

Thank You so much, Danny!

Please Romana, apply the patch in the future, because not everybody using Joomla 4 yet!

BTW thank You for this great newsletter extension!
chrome_XFoboqfnqA.png (65,435 bytes)   
chrome_XFoboqfnqA.png (65,435 bytes)   

Romana

2022-11-28 21:22

administrator   ~0000073

Hi TrackerBlaster,

thank You very much for Your comment. Yes, I will add this bug fix to the next version of BwPostman. I plan to publish it before Christmas.

Hth
Romana

Issue History

Date Modified Username Field Change
2022-09-01 18:16 dstreichert New Issue
2022-09-01 18:16 dstreichert Tag Attached: Patch
2022-09-02 16:03 Romana Note Added: 0000055
2022-09-02 16:08 dstreichert Note Added: 0000056
2022-09-02 16:15 Romana Note Added: 0000057
2022-09-02 16:24 Romana Note Edited: 0000057 View Revisions
2022-09-02 16:24 Romana Note Edited: 0000057 View Revisions
2022-09-02 16:47 dstreichert Note Added: 0000058
2022-09-02 23:37 Romana Note Added: 0000059
2022-09-03 09:49 Romana Product Version 2.3 => 3.x
2022-09-06 11:10 Romana Note Added: 0000061
2022-09-06 11:24 dstreichert Note Added: 0000062
2022-09-06 13:56 Romana Note Added: 0000063
2022-10-31 15:59 dstreichert Note Added: 0000064
2022-11-05 12:48 Romana Note Added: 0000065
2022-11-26 01:45 TrackerBlaster Note Added: 0000072
2022-11-26 01:45 TrackerBlaster File Added: chrome_XFoboqfnqA.png
2022-11-28 21:22 Romana Note Added: 0000073
2023-05-02 12:39 Romana Assigned To => Romana
2023-05-02 12:39 Romana Status new => resolved
2023-05-02 12:39 Romana Resolution open => fixed