Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-10-25 09:50:20

Gallex
Member
Registered: 2006-10-08
Posts: 1,289

admin-side error after fresh install

Notice “A non well formed numeric value encountered”
in /www/apache/domains/www.pearaamatupidaja.ee/htdocs/textpattern/include/txp_prefs.php at line 819.

textpattern/include/txp_prefs.php:819 adminErrorHandler()
textpattern/include/txp_prefs.php:90 real_max_upload_size()
textpattern/include/txp_prefs.php:49 prefs_save()
textpattern/index.php:211 include()

txp: 4.6.2
PHP: 7.1.2

Offline

#2 2017-10-25 09:57:37

Gallex
Member
Registered: 2006-10-08
Posts: 1,289

Re: admin-side error after fresh install

it’s gone by itself… ;) wierd

Offline

#3 2017-12-27 16:17:56

Ewald
New Member
Registered: 2017-12-27
Posts: 3

Re: admin-side error after fresh install

I got this same error, on the Settings page (Textpattern 4.6.2, PHP 7.1). For me, it didn’t go away by itself. In the thread Never seen this popup before … !?, user Etc indicates the reason for this , but the solution he posted is not correct .

The problem is, that in the function real_max_upload_size() in /textpattern/include/txp_prefs.php, the variable $var is used both as a string and an integer, but that the string may contain also a letter. PHP 7.1 no longer accepts that, when a string is used as an int. The PHP NOTICE is there for values like ‘8M’ for the max. upload size.

The PHP NOTICE can be made to go away by using the intval() or floatval() function, when $val is supposed to be treated like a number. It must come after the line $modifier = strtolower(substr($val, -1));

So:

foreach ($candidates as $item) {
        $val = trim($item);
        $modifier = strtolower(substr($val, -1));
        $val = floatval($val);
        switch ($modifier) {
            // The 'G' modifier is available since PHP 5.1.0
            case 'g':
                $val *= 1024;
            case 'm':
                $val *= 1024;
            case 'k':
                $val *= 1024;
        }
        if ($val > 1) {
            if (is_null($real_max)) {
                $real_max = $val;
            } elseif ($val < $real_max) {
                $real_max = $val;
            }
        }
    }

Last edited by Ewald (2017-12-27 19:25:10)

Offline

Board footer

Powered by FluxBB