PHP Deprecated: Non-static method

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 - 

//forum.phpvms.net/applications/core/interface/index.html

 

3 hours ago, vicsimvp said:

https://forum.phpvms.net/t/topic/12504

which version of phpvms do you have?

Simpilot 5.5.x or phpvms 5.4 (nabeel)?

 

Just now, ProSkyDesign said:

which version of phpvms do you have?

Simpilot 5.5.x or phpvms 5.4 (nabeel)?

Please forgive my ignorance but how do I find that out?

4 hours ago, vicsimvp said:

 

Please forgive my ignorance but how do I find that out?

http://your_site_url/admin/index.php/settings

and find the following field: phpVMS Version

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.

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

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)

14 hours ago, ProSkyDesign said:

http://your_site_url/admin/index.php/settings

and find the following field: phpVMS Version

2.1.934

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](< base_url >/applications/core/interface/file/attachment.php?id=4353)

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](< base_url >/applications/core/interface/file/attachment.php?id=4353)

 

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.

 

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