Jump to content

Recommended Posts

Posted (edited)

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;
    }

Edited by djtiger76
  • Moderators
Posted
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

  • Like 1
  • Administrators
Posted

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

Posted

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!

  • Moderators
Posted

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.

  • Moderators
Posted
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" :)!

Posted

@shakamonkey88 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. 

  • Administrators
Posted
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.

  • Like 1
  • Administrators
Posted

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.

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