Sim Posted June 22, 2020 Share Posted June 22, 2020 (edited) If I'm not mistaken GL has its own constructor for mods: public $helper = null; public function constructModule() { include "class/ItemHelperFunctions.php"; $this->helper = new ItemHelperFunctions(); $this->method_view(); } Now the issue rises: All my methods I had to include in my helper class $this->getSelectedItem(); becomes $this->helper->getSelectedItem (); But the real issue is on 2 of the 6 mods it doesn't work. $helper remains NULL(doesn't assign). Anyone got a solution? Or know the problem? I even tried using the regular constructor but the problem remains the same on 2 of the 6 mods. It's got me a bit confused. Error: Uncaught Error: Call to a member function getSelectedItem() on null in /home/simmakew/public_html/GL/modules/installed/blackMarket/blackMarket.inc.php:357 Stack trace: #0 Edit: The constructors in any GL module following @Dayoformat is broke. Using the method constructModule is not called first UNLESS ANOTHER METHOD IS NOT CALLED . To fix this issue Open: class/module.PHP Find: if ($this->construct) { $this->constructModule(); } MOVE BEFORE: if (isset($this->methodData->action)) { $methodAction = 'method_'.$this->methodData->action; if (method_exists($this, $methodAction)) { $this->$methodAction(); } } Now I am not %100 sure why function __construct() Does not keep the globals from module PHP. The globals, $page, $db, $user no longer work. $this->page, $this->DB, $this->user By my fix above handles all issues I have mentioned. Error: Uncaught Error: Call to a member function prepare() on null in Edited June 23, 2020 by Sim Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.