vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   PHP Warning After Move To New Host (https://vborg.vbsupport.ru/showthread.php?t=326946)

HM666 12-05-2018 07:53 PM

PHP Warning After Move To New Host
 
I'm getting the following warning after moving my websites to a new host when I try to save a template after editing it. The old host was running PHP 5.6, the new one is running PHP 7.2.12.

Code:

PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in ..../includes/class_core.php on line 4224
Here is what is in that part of the file.

Code:

        // only called when an object is destroyed, so $this is appropriate
        public function shutdown()
        {
                if (sizeof($this->callbacks))
                {
                        foreach ($this->callbacks AS $callback)
                        {
                                call_user_func($callback);
                        }

                        unset($this->callbacks);
                }
        }

        public function __wakeup()

I can edit templates but it will not show the edits on the site. Any help would be great.

shka 12-05-2018 08:19 PM

One of the changes from php 7.1 => 7.2 http://php.net/manual/en/migration72.incompatible.php
Warn when counting non-countable types
An E_WARNING will now be emitted when attempting to count() non-countable types (this includes the sizeof() alias function).

Try

PHP Code:

        if ( is_array($this->callbacks) || $this->callbacks instanceof Countable )
        {
            foreach (
$this->callbacks AS $callback)
            {
                
call_user_func($callback);
            }

            unset(
$this->callbacks);
        } 

In php 7.3 there will be a is_countable() function. https://wiki.php.net/rfc/is-countable

But vB4 isn't compatible with php7.2. So this will be only the starting point of a never ending error-solution-error-warning-error...circle. Go back to 7.1 if possible.

HM666 12-05-2018 08:50 PM

Thanks for the info the code worked. I have not seen any other warnings or errors so far. I'm on shared hosting so I may not be able to go backwards on PHP. :(

Wisc 12-10-2018 06:03 AM

HM666 are you on godaddy?

Getting same junk.
You can choose the php version in the control panel (of godaddy) i think myphp

HM666 12-10-2018 08:24 AM

Quote:

Originally Posted by Wisc (Post 2597724)
HM666 are you on godaddy?

Getting same junk.
You can choose the php version in the control panel (of godaddy) i think myphp

Nope have not used GoDaddy in years for hosting. :) I'm on Bluehost, but I have since had this situation solved by the host. :)


All times are GMT. The time now is 12:57 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01143 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete