• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed PHP 7.1.0 Upgrade Error

Brent W

Well-known member
#1
After an upgrade to 7.1.0 I receive this error across every page on the site:

Code:
A non well formed numeric value encountered in /home/nginx/domains/christianforums.com/public/library/XenForo/Application.php on line 1554
 

Mike

XenForo developer
Staff member
#2
There's a legitimate bug here, though I had to do some code manipulation/php.ini changes to manage to trigger it.

A workaround should be to set "output_buffering" to 4096 in your php.ini.
 

Brent W

Well-known member
#5
I applied both the php.ini change, confirmed it took and changed the code. All that did is move the error down a line:

Code:
[02-Dec-2016 06:09:20 America/Chicago] PHP Notice:  A non well formed numeric value encountered in /home/nginx/domains/christianforums.com/public/library/XenForo/Application.php on line 1554
 

Mike

XenForo developer
Staff member
#6
Are you positive it took? That line number is the same as the previous one and if it took, the line numbers should have all moved down 3 lines.
 

Brent W

Well-known member
#7
It is within this code block that I was suppose to change it correct?

PHP:
    /**
     * Gets the current memory limit.
     *
     * @return int
     */
    public static function getMemoryLimit()
    {
        if (self::$_memoryLimit === null)
        {
            $curLimit = @ini_get('memory_limit');
            if ($curLimit === false)
            {
                // reading failed, so we have to treat it as unlimited - unlikely to be able to change anyway
                $curLimit = -1;
            }
            else
            {
                $format = substr($curLimit, -1);
                        $curLimit = intval($curLimit);

                        switch ($format)
                {
                    case 'g':
                    case 'G':
                        $curLimit *= 1024;
                        // fall through

                    case 'm':
                    case 'M':
                        $curLimit *= 1024;
                        // fall through

                    case 'k':
                    case 'K':
                        $curLimit *= 1024;
                }
            }

            self::$_memoryLimit = intval($curLimit);
        }

        return self::$_memoryLimit;
    }
 

Brent W

Well-known member
#8
So I am not going crazy... this is live right now though I have downgraded back to 7.0.13. Also, confirmed that the php.ini change took as well with a phpinfo file outside of XenForo since it was down. When php is upgraded it is automatically restarted though I did a manually restart too just to make sure. No change in error.

Selection_003.png
 

Mike

XenForo developer
Staff member
#9
That is the correct block. The error should have changed to line 1557 though with that code. If it didn't change, that would probably point to the opcode cache not updating (which may be how it's configured to be).
 

Brent W

Well-known member
#11
That is the correct block. The error should have changed to line 1557 though with that code. If it didn't change, that would probably point to the opcode cache not updating (which may be how it's configured to be).
I will give it one more run with opcache specifically disabled and see where we stand.
 

Chris D

XenForo developer
Staff member
#16
Depends on the style. Realistically, you shouldn't really let styling matters constrain you from updating. You might be missing important fixes... ;)