AbanteCart Community

eCommerce construction => Installation and Configuration => Topic started by: gcleff on January 19, 2017, 02:10:38 AM

Title: Help Please a Fresh install i got Warning A non-numeric value encountered
Post by: gcleff on January 19, 2017, 02:10:38 AM
Hi im installing v1.2.9 at lincense ok at compatibility all ok at configuration ok at data load i get this error

Following error has occurred during installation:
OK: {"ret_code":50}
Name
Info
2::warning
A non-numeric value encountered in /storage/h3/704/571704/public_html/core/lib/request.php on line 148
2::warning
A non-numeric value encountered in /storage/h3/704/571704/public_html/core/lib/request.php on line 148
2::warning
A non-numeric value encountered in /storage/h3/704/571704/public_html/core/lib/request.php on line 148\

Can you help me with this thanks a lot.

below is the line 148 of request.php
   private function _detectBrowser(){

      $nua = strToLower($_SERVER['HTTP_USER_AGENT']);

      $agent['http'] = isset($nua) ? $nua : "";
      $agent['version'] = 'unknown';
      $agent['browser'] = 'unknown';
      $agent['platform'] = 'unknown';
      $agent['device_type'] = '';

      $oss = array ('win', 'mac', 'linux', 'unix');
      foreach ($oss as $os){
         if (strstr($agent['http'], $os)){
            $agent['platform'] = $os;
            break;
         }
      }

      $browsers = array ("mozilla", "msie", "gecko", "firefox", "konqueror", "safari", "netscape", "navigator", "opera", "mosaic", "lynx", "amaya", "omniweb");

      for ($i = 0; $i < count($browsers); $i++){
         if (strlen(stristr($nua, $browsers[$i])) > 0){
            $agent["browser"] = $browsers[$i];
            $n = stristr($nua, $agent["browser"]);
            $j = strpos($nua, $agent["browser"]) + $n + strlen($agent["browser"]) + 1; <--Line 148
         }
      }
Title: Re: Help Please a Fresh install i got Warning A non-numeric value encountered
Post by: abolabo on January 19, 2017, 06:31:03 AM
what browser do you use?

Try to replace

Code: [Select]
$agent["browser"] = $browsers[$i];
with this

Code: [Select]
$agent["browser"] = (string)$browsers[$i];and let us know
Title: Re: Help Please a Fresh install i got Warning A non-numeric value encountered
Post by: gcleff on January 19, 2017, 09:00:07 PM
Hi Thank you for the help i both used IE and Firefox.

I made the change you gave me the error still persist.

      for ($i = 0; $i < count($browsers); $i++){
         if (strlen(stristr($nua, $browsers[$i])) > 0){
            $agent["browser"] = (string)$browsers[$i]; <--Change
            $n = stristr($nua, $agent["browser"]);
            $j = strpos($nua, $agent["browser"]) + $n + strlen($agent["browser"]) + 1; <--- Line 148

Following error has occurred during installation:
OK: {"ret_code":50}
Name    Info
2::warning
   A non-numeric value encountered in /storage/h3/704/571704/public_html/core/lib/request.php on line 148
2::warning
   A non-numeric value encountered in /storage/h3/704/571704/public_html/core/lib/request.php on line 148
2::warning
   A non-numeric value encountered in /storage/h3/704/571704/public_html/core/lib/request.php on line 148
Title: Re: Help Please a Fresh install i got Warning A non-numeric value encountered
Post by: abolabo on January 20, 2017, 02:24:39 AM
oh... actually you can comment line 148.
i guess you have some security software that hides browser's request headers.
Title: Re: Help Please a Fresh install i got Warning A non-numeric value encountered
Post by: gcleff on January 31, 2017, 03:27:36 AM
i solved it by copying the script from old version of abantecart thanks for the help