Fixed PHP 7.1.0 Upgrade Error

Brent W

Well-known member
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
 
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.
 
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
 
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.
 
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;
    }
 
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.webp
 
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).
 
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.
 
Depends on the style. Realistically, you shouldn't really let styling matters constrain you from updating. You might be missing important fixes... ;)
 
Top Bottom