Deprecated: The each() function is deprecated.

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/tstamer/public_html/crew/core/classes/Config.class.php on line 108

 

Not sure what happened between this morning and now, but just went to my site (http://test.americanva.org) and on the home page I have a depreciated message. I don’t know what needs to be done to correct it or hide the message. Can someone help?

Here is the code for that area

 

 

    /**
     * Load all the site settings. Make the settings into define()'s
     *    so they’re accessible from everywhere
     */
    public static function LoadSettings() {
        while (list($key, $value) = each(self::$values)) {
            if (!is_array($value)) {
                if (!defined($key)) {
                    define($key, $value);
                }
            }
        }

        return true;
    }

1 hour ago, djtiger76 said:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/tstamer/public_html/crew/core/classes/Config.class.php on line 108

 

Not sure what happened between this morning and now, but just went to my site (http://test.americanva.org) and on the home page I have a depreciated message. I don’t know what needs to be done to correct it or hide the message. Can someone help?

Here is the code for that area

 

 

    /**
     * Load all the site settings. Make the settings into define()'s
     *    so they’re accessible from everywhere
     */
    public static function LoadSettings() {
        while (list($key, $value) = each(self::$values)) {
            if (!is_array($value)) {
                if (!defined($key)) {
                    define($key, $value);
                }
            }
        }

        return true;
    }

A quick solution should be:

go to core/local.config.php and find the following in top of file:

Config::Set('DEBUG\_MODE', false);

and change to true like this:

Config::Set('DEBUG\_MODE', true);

seems  as a php version debug error

1 Like

What version of phpVMS?

What version of PHP?

What version of MySQL/MariaDB?

 

phpVMS 5.5.2

PHP Version 5.6

MySql 5.7.22

 

ProSky’s suggestion worked. But I still don’t understand what happened between now and this morning to cause all of the errors

Its weird you saw the deprecated warning as ‘each’ wasn’t deprecated until php 7.2 

Have you checked you host to see if they changed the base php version to 7.2

 

The line in question is:

while (list($key, $value) = each(self::$values)) {

 

What happens if you change it to:

foreach(self::$values as $key=>$value) {

 

Make sure to back up that file first in case it doesn’t work or breaks your site. The above change was made to phpVMS 5.5.2.72 to make it compatible with php 7.2 . And you should be able to set debug mode to off again in local.config

Hey ProAvia,

 

I saw another website that mentioned the while vs. foreach functions as a culprit, but was not sure how to rewrite that line. I changed that line and changed debug back to false and no errors. I promise I didn’t change that before today. Is it possible a mod i installed could have changed that and created the errors?

 

Thanks much!

That is definitely weird that it randomly started throwing an error for you. I’d also suggest checking with your provider just in case.

 

I’d be wary of simply turning off error reporting. That doesn’t solve anything and doesn’t eliminate errors, it simply hides them. Anyone can sweep problems under the carpet, but “out of sight, out of mind” is not a good approach in my opinion.

7 hours ago, shakamonkey88 said:

That is definitely weird that it randomly started throwing an error for you. I’d also suggest checking with your provider just in case.

 

I’d be wary of simply turning off error reporting. That doesn’t solve anything and doesn’t eliminate errors, it simply hides them. Anyone can sweep problems under the carpet, but “out of sight, out of mind” is not a good approach in my opinion.

That’s ok is not the final solution but he needs to get his site on… Now he should search the final solution… As I said is the “quick solution” :)!

 Wasn’t meant for that at all, he just needs to get his site up and running, and lately all posts I have made, have been interupted for sure,  but thats ok, I understand that you continue on a certain path . Well noted , we do have an issue here. 

On 3/9/2020 at 6:29 AM, djtiger76 said:

Hey ProAvia,

 

I saw another website that mentioned the while vs. foreach functions as a culprit, but was not sure how to rewrite that line. I changed that line and changed debug back to false and no errors. I promise I didn’t change that before today. Is it possible a mod i installed could have changed that and created the errors?

 

Thanks much!

I highly doubt a module changed it. What you showed in your post is the default for phpVMS 5.5.2 and prior. What I suggested is from phpVMS 5.5.2.72. My change makes it compatible with PHP 7.2 - and should not affect usability.

 

I usually look for a way to fix the issue rather than turn off error reporting - unless you need to get the site functional again quickly. And I suggest you run a developmemt site using an exact copy of your site so you can test out possible fixes or test new modules while your main site stays available for your pilots.

1 Like

Good Idea. Almost at the point where I can start importing pilots. Then ill make a copy from there to play with. 

I always keep a backup of the site and the db running to play around with. Much easier to test on. And my site stays up if/when I break the dev site.