Jump to content

Error after update to 7.6 on admin login


arobo

Recommended Posts

Hi,

After updating to WHMCS 7.6 we are unable to login to the admin section.

 

We are getting the following error in our logs -

 [php7:notice] [WHMCS Application] ERROR: Error: Call to undefined method WHMCS\\Admin::getRoleID() in /xxxxx/widgets/system_overview.php:156 Stack trace: #0 /xxxxx/includes/hookfunctions.php(0): widget_system_overview_home_banner(Array) #1 /xxxx/vendor/whmcs/whmcs-foundation/lib/Admin/Controller/HomepageController.php(0): run_hook('AdminHomepage', Array) #2 [internal function]: WHMCS\\Admin\\Controller\\HomepageController->index(Object(WHMCS\\Http\\Message\\ServerRequest)) #3 /xxxx/vendor/middlewares/utils/src/CallableHandler.php(26): call_user_func_array(Array, Array) #4 /xxxx/vendor/middlewares/fast-route/src/FastRoute.php(96): Middlewares\\Utils\\CallableHandler::execute(Array, Array) #5 /xxxxxxx/vendor/whmcs/whmcs-foundation/lib/Route/Middleware/HandleProcessor.php(0): Middlewares\\FastRoute->process(Object(WHMCS\\Http\\Message\\ServerRequest), Object(Middlewares\\Utils\\Delegate))  .... and so on.......

 

Has anybody seen this issue before ? Any ideas on how to resolve and fix?

 

Regards,

 

 

 

Link to comment
Share on other sites

HI Arobo, 

Please rename these file "system_overview.php,  widget_system_overview_home_banner.php " and then check the "role" permission of that admin user "with which user account, you are trying to login".  

Or

May be your current user do not have permissions to view this widget. 

Thanks

 

Link to comment
Share on other sites

  • WHMCS Staff

Hi @arobo,

Thanks for posting in the WHMCS.community!

I can confirm that when you are presented with an error like this, the first PHP error is usually the most helpful. In this case:

Error: Call to undefined method WHMCS\\Admin::getRoleID() in /xxxxx/widgets/system_overview.php:156

This shows that there is an undefined method in a specific file.

As this file is located in /modules, this indicates that it is likely one of two things, an outdated file or a problematic third-party addon.

In this case, this file is outdated and no longer shipped with WHMCS. EDIT: This is a very old Admin Dashboard widget was shipped with WHMCS v6.x - This has been replaced by the overview.php file.

You should create a new directory called ".disabled" in the same directory that the file lies and then move the file specified in to .disabled - Moving this file from /xxxxx/widgets/system_overview.php to /xxxxx/widgets/.disabled/system_overview.php disables the file but does not remove it, just in case you need it later.

I'm happy to confirm that it is safe for you to permanently delete this file. (/xxxxx/widgets/system_overview.php)

I hope this helps.

Edited by WHMCS Peter
Added where file originated from for transparency.
Link to comment
Share on other sites

It would be good to know which module this file comes from.

A bit safer fix than completly removing system_overview.php is commenting the function causing the issue widget_system_overview_home_banner() much like so:

/*function widget_system_overview_home_banner() {
    $roleid = Admin::getRoleID();
    $widgets = get_query_val("tbladminroles","widgets",array("id"=>$roleid));
    $widgets = explode(',',$widgets);
    $banner = (in_array('system_overview',$widgets)) ? '<div id="sysoverviewbanner"><div style="margin:0;padding: 10px;background-color: #FBEEEB;border: 1px dashed #cc0000;font-weight: bold;color: #cc0000;font-size:14px;text-align: center;"><img src="images/loading.gif" /></div></div>' : '';
    return $banner;
}*/

add_hook("AdminHomeWidgets",1,"widget_system_overview");
//add_hook("AdminHomepage",1,"widget_system_overview_home_banner");

and hopefully, next update will overwrite the file and fix it the broken function.

Edited by WHMCS ChrisD
Placed code in a code box
Link to comment
Share on other sites

Hi Dawid,

2 hours ago, Skyline Servers said:

It would be good to know which module this file comes from.

it's from the old v6 system_overview.php admin widget, which because WHMCS renamed the updated equivalent to Overview.php, doesn't get overwritten or removed... the function itself is irrelevant, it's that second add_hook line that caused the issue...

add_hook("AdminHomepage",1,"widget_system_overview_home_banner");

get rid of that line and the error goes away from the homepage... the widget will then work, but frankly i'd go along with @WHMCS Peter suggestion and delete the file... even if it works fine now, there's no guarantee that it will after a future update.

Link to comment
Share on other sites

OK if it's part of v6 installation I agree it does make sense to remove it then, but a questions came up...

If the file isn't needed anymore shouldn't it be deleted with v7 update? sounds like that would be good practice and would prevent this also

If file wouldn't be in needed/used at all it wouldn't be called on dashboard page load and caused an error in the dashboard in the first place right so common sense just dictates that this file is loaded by something and is used by WHMCS v7 installations since the dashboard breaks with it in place because of that old function there. I mean having random php script placed in widgets shouldn't render dashboard unusable right. 

Oh wait but it does. I just tested this and any PHP script uploaded to modules/widget is being executed on dashboard render (possibly other pages?) thus making it possible to break it or even possibly cause other malicious actions like take over admin privileges, perform actions as admin if the script we put there is executed as admin user viewing the dashboard anything we add there will be executed as well. Offcourse it first must be possible to place such script into WHMCS installation modules/widget directory, but if we keep in mind that WHMCS now has autoupdates that require web server user to have to write permission to WHMCS site code directory for updates to happen so this possibility might not be so far fetched, some web server misconfiguration or setup mistakes could allow for uploading a file to the server in some cases.

Link to comment
Share on other sites

  • WHMCS Support Manager

Hi @Skyline Servers,

When the admin widgets were refreshed in 7.1, we included a routine in the update processes to automatically remove the old style ones.

If these older widget files are still present in the /modules/widgets directory today, it suggests a permission issue occurred which prevented them being deleted automatically back then.

We went to great efforts to ensure that old widgets would still work in 7.2 to help ease the transition, but as they are discontinued, do not receive maintenance or testing, so we cannot guarantee their functionality in newer versions.

The widgets are not encoded, so you are welcome to modify and maintain them yourself per @brian! 's example.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated