Quantcast
Viewing all articles
Browse latest Browse all 5991

get a "Non static method" error after from PHP7.0 to PHP 8.3

I have the following PHP error message after upgrading from PHP7.0 to PHP8.3

PHP Parse error:  syntax error, unexpected identifier "CLASS_MANAGEMENT", expecting "::"   

about the code as below

<?php  require_once('../includes/file/group.inc');     foreach (CLASS_MANAGEMENT::getClassList() as $class_id) {            $class_info = CLASS_MANAGEMENT::getClassInfo($class_id);            $class_list[] = $class_info;      }

Any ideas how to rewrite this to be OK?

I have try to add "public static" modify my function in class (group.inc) ,as below

class CLASS_MANAGEMENT{  public static function getClassList($class_id = null)     {            if (!$class_id) return;            global $db;            $query = $db->query("                    select *                    from    FILE                    where   CLASS_ID = $class_id");            $result = $db->fetchArray($query);            return $result;      }   .......}

Viewing all articles
Browse latest Browse all 5991

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>