Page 1 of 1

[SOLVED] This site doesn't allow you to save PinsUninitialized string offset: 0 in admin/controller/tool/tweaks.php

Posted: Tue Apr 26, 2022 9:09 pm
by IP_CAM
A technical Question:
I found this Notice in my Openshop 1.5.6.5_rc based TWEAKS Extension, most likely related to PHP v.7.4.x:
Notice: Uninitialized string offset: 0 in admin/controller/tool/tweaks.php on line 175

Code: Select all

 foreach ($tfiles as &$tfile) {
              $tfile = str_replace('../','',$tfile);
-----          if ($tfile[0] == '/') $tfile = substr($tfile,1);     -----  Line 175
               }
              if (!$tfiles) $tfiles = array();
                 $tfiles = array_unique($tfiles);
                 sort($tfiles);
                 $info['files'] = $tfiles;
               }
Possibly someone is willing to help me with this, I would be happy, to get this fixed!
Ernie

Re: Uninitialized string offset: 0 in admin/controller/tool/tweaks.php

Posted: Tue Apr 26, 2022 9:36 pm
by cyclops12
Maybe you could get some help from this ernie ??
https://www.php.net/manual/en/migration ... atible.php

Or maybe on the Changed Functions page this might be your problem

Re: Uninitialized string offset: 0 in admin/controller/tool/tweaks.php

Posted: Tue Apr 26, 2022 10:25 pm
by JNeuhoff
Try

Code: Select all

if (substr($tfile,0,1) == '/') $tfile = substr($tfile,1);

Re: Uninitialized string offset: 0 in admin/controller/tool/tweaks.php

Posted: Tue Apr 26, 2022 10:28 pm
by OSWorX
Or instead:

Code: Select all

if ($tfile[0] == '/') $tfile = substr($tfile,1);

Code: Select all

if (isset($tfile[0]) && $tfile[0] == '/') {
  $tfile = substr($tfile,1);
}

Re: Uninitialized string offset: 0 in admin/controller/tool/tweaks.php

Posted: Tue Apr 26, 2022 11:15 pm
by IP_CAM

Code: Select all

if (substr($tfile,0,1) == '/') $tfile = substr($tfile,1);
Well, this one seems to have worked out well.
Thanks a lot! ;)