Jump to content

PHP Deprecated: Non-static method


vicsimvp

Recommended Posts

Hello all.  I am pretty new to PHPVMS but I am faced with a tough one here.  I keep getting the following error - 

PHP Deprecated: Non-static method kACARSChatData::getMessage() should not be called statically, assuming $this from incompatible context in /home/virtualu/public_html/core/modules/kACARS_Chat/kACARS_Chat.php on line 51

I have already made the changes as stated in the referenced link. 

Any help is appreciated, also please assume I know very little about this.  Your simplicity will be much appreciated.

Specs - Working on PHP version 5.6.40

PHPVMS version - 

 

Link to comment
Share on other sites

  • Moderators
3 hours ago, vicsimvp said:

Hello all.  I am pretty new to PHPVMS but I am faced with a tough one here.  I keep getting the following error - 

PHP Deprecated: Non-static method kACARSChatData::getMessage() should not be called statically, assuming $this from incompatible context in /home/virtualu/public_html/core/modules/kACARS_Chat/kACARS_Chat.php on line 51

I have already made the changes as stated in the referenced link. 

Any help is appreciated, also please assume I know very little about this.  Your simplicity will be much appreciated.

Specs - Working on PHP version 5.6.40

PHPVMS version - 

 

which version of phpvms do you have?

Simpilot 5.5.x or phpvms 5.4 (nabeel)?

Link to comment
Share on other sites

  • Administrators

If you are on php 5.6.40, chances are you are using phpVMS version 5.5.2 or the updated phpVMS version 2 (sometimes referred to as phpVMS 5). In any case, go to your admin panel in phpVMS and look in the lower right corner and you should see the version number.

As for the "Non-static method" - you will see this quite often if a module has not been updated in a while. Do a forum search for "Non-static method" (with the quotes) and you will find lots of posts with solutions. Basically, if the particular line you referenced above (.../core/modules/kACARS_Chat/kACARS_Chat.php on line 51) starts with 'public function', change it to 'public static function' and save the file. That usually will fix it.

If that doesn't do it, contact me via PM (as kACARS and it's chat module are payware) and maybe I can assist you.

Link to comment
Share on other sites

  • Administrators
5 hours ago, ProSkyDesign said:

which version of phpvms do you have?

Simpilot 5.5.x or phpvms 5.4 (nabeel)?

There is no phpVMS 5.4

phpVMS versions

  • phpVMS 2.x - legacy version - php 4
  • phpVMS 5.5.2 - simpilot version - php 5.2-5.6
  • phpVMS v2 - legacy version (sometimes wrongly called version 5) - php 7
  • phpVMS 5.5.2.72 - phpVMS 5.5.2 updated to work with php 7.0-7.2
  • phpVMS 7 - not released yet - php 7.2 and above
Link to comment
Share on other sites

  • Moderators
2 minutes ago, ProAvia said:

There is no phpVMS 5.4

phpVMS versions

  • phpVMS 2.x - legacy version - php 4
  • phpVMS 5.5.2 - simpilot version - php 5.2-5.6
  • phpVMS v2 - legacy version (sometimes wrongly called version 5) - php 7
  • phpVMS 5.5.2.72 - phpVMS 5.5.2 updated to work with php 7.0-7.2
  • phpVMS 7 - not released yet - php 7.2 and above

great correction, (I used to name that version for the php 5.4 compatibility lol)

Link to comment
Share on other sites

14 hours ago, ProAvia said:

As for the "Non-static method" - you will see this quite often if a module has not been updated in a while. Do a forum search for "Non-static method" (with the quotes) and you will find lots of posts with solutions. Basically, if the particular line you referenced above (.../core/modules/kACARS_Chat/kACARS_Chat.php on line 51) starts with 'public function', change it to 'public static function' and save the file. That usually will fix it.

PHP Deprecated: Non-static method kACARSChatData::getMessage() should not be called statically, assuming $this from incompatible context in /home/virtualu/public_html/core/modules/kACARS_Chat/kACARS_Chat.php on line 51

When I change it from 'public function' to 'public static function' the error changes to this - 

PHP Fatal error:  Using $this when not in object context in /home/virtualu/public_html/core/modules/kACARS_Chat/kACARS_Chat.php on line 49

Attached you will find the block in question. 

Error on php.zip

Link to comment
Share on other sites

  • Administrators
1 hour ago, vicsimvp said:

PHP Deprecated: Non-static method kACARSChatData::getMessage() should not be called statically, assuming $this from incompatible context in /home/virtualu/public_html/core/modules/kACARS_Chat/kACARS_Chat.php on line 51

When I change it from 'public function' to 'public static function' the error changes to this - 

PHP Fatal error:  Using $this when not in object context in /home/virtualu/public_html/core/modules/kACARS_Chat/kACARS_Chat.php on line 49

Attached you will find the block in question. 

Error on php.zip 23.45 kB · 1 download

 

As I suggested in my previous post.....

Quote

If that doesn't do it, contact me via PM (as kACARS and it's chat module are payware) and maybe I can assist you.

 

Link to comment
Share on other sites

There is One File that creates these errors, especially the $this statement. This is ongoing ,especially any and all Older Modules, such as the Credits Module , and much more. Here is a simple fix to test it and see if the Errors disappear, if works, then leave it the way it is. Again, for some strange reason unless your running php version 5.3.xx, you will get errors with any and all newer versions of the PHP version on your Server. I am running on my Site 90% of the Older Module's such as The Credits module, the popup news , and the Exams module, all on php 5.6.xx. Server version.

Here is the simple fix, "REMEMBER" to make a copy of the original somewhere, or re-name it to codeon.config.php.bak. The file obviously is the codeon.config.php file, below are the changes you can make to it, its "ONLY" ONE line that needs to be changed, don't mess with anything else. This file lives in the "www.mysite.com/core/codeon.config.php

Look for line 40-42, around there, you will see this, pay attention to the changes I've made;

session_start();

error_reporting(E_ALL ^ E_NOTICE);
# @ini_set('display_errors', 'on'); This is the only line to CHANGE nothing else as you can see below is off now
@ini_set('display_errors', 'off');

define('DS', DIRECTORY_SEPARATOR);
define('SITE_ROOT', str_replace('core', '', dirname(__FILE__)));
define('CORE_PATH', dirname(__FILE__) );
define('CORE_LIB_PATH', CORE_PATH.DS.'lib');
define('CLASS_PATH', CORE_PATH.DS.'classes');
define('LOGS_PATH', CORE_PATH.DS.'logs');
define('TEMPLATES_PATH', CORE_PATH.DS.'templates');
define('MODULES_PATH', CORE_PATH.DS.'modules');
define('CACHE_PATH', CORE_PATH.DS.'cache');
define('COMMON_PATH', CORE_PATH.DS.'common');
define('PAGES_PATH', CORE_PATH.DS.'pages');
define('LIB_PATH', SITE_ROOT.DS.'lib');
define('VENDORS_PATH', CORE_PATH.DS.'vendors');

Again , do NOT change anything else unless you know what your doing, make a backup also, this works flawlessly on my Web Site, hope this helps you.

Jim

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.   Restore formatting

  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.

Loading...
×
×
  • Create New...