Acer Posted April 14, 2020 Share Posted April 14, 2020 (edited) Hi there I know this is a PHP error, but hopefully you guys can provide a fix... I'm trying to install one of Leo Theme's templates: Game Gearhttps://www.leotheme.com/prestashop/themes/313-leo-gamegear.html But I'm getting the following 500 error: in file modules/leotempcp/leotempcp.php at line 1263 Cannot use string offset as an array in file modules/leotempcp/leotempcp.php at line 1263 1261: if ($directories) { 1262: foreach ($directories as $dir) { 1263: $output['skins'][basename($dir)]['name'] = $this->l(basename($dir)); 1264: if (file_exists($dir.'/icon.png')) { 1265: $output['skins'][basename($dir)]['icon'] = _PS_BASE_URL_._THEME_DIR_.'css/skins/'.basename($dir).'/icon.png'; 1266: } 1267: } 1268: } Can you please help? Got a feeling that line 1263 needs to be rewritten for latest PHP (I'm running 7.2+) Your help is appreciated in advance! Edited April 15, 2020 by Theo Link to comment Share on other sites More sharing options...
Occam Posted April 14, 2020 Share Posted April 14, 2020 Maybe it helps to rename all instances of $dir to $dirX. Link to comment Share on other sites More sharing options...
Acer Posted April 14, 2020 Author Share Posted April 14, 2020 4 minutes ago, Occam said: Maybe it helps to rename all instances of $dir to $dirX. Ummm. Not sure what this would achieve, but ok... Tried it and it doesn't work 😕 Any other ideas? Link to comment Share on other sites More sharing options...
Occam Posted April 14, 2020 Share Posted April 14, 2020 Did you recompile the theme afterwards? Link to comment Share on other sites More sharing options...
Acer Posted April 14, 2020 Author Share Posted April 14, 2020 (edited) 17 minutes ago, Occam said: Did you recompile the theme afterwards? Theme bombs out on accessing admin with Error 500, so I can't get to Performance screen. The only way I got to see what was going on was by activating Debug in defines.inc.php. Now after file update and page refresh, the error page reflects the update in the code that it displays and highlights (so not a caching thing where it still uses previous version). Edited April 14, 2020 by Theo Link to comment Share on other sites More sharing options...
datakick Posted April 15, 2020 Share Posted April 15, 2020 change lines 1256-1257 from $output = array(); $output = array('skins' => '', 'layouts' => ''); to $output = array('skins' => array(), 'layouts' => ''); Link to comment Share on other sites More sharing options...
Acer Posted April 15, 2020 Author Share Posted April 15, 2020 1 hour ago, datakick said: change lines 1256-1257 from $output = array(); $output = array('skins' => '', 'layouts' => ''); to $output = array('skins' => array(), 'layouts' => ''); Excellent. This worked, thank you 😀 Link to comment Share on other sites More sharing options...
Acer Posted April 15, 2020 Author Share Posted April 15, 2020 (edited) Ah spoke to soon... Sorry @datakick, need your help again please. New error: Call to a member function attributes() on boolean line 1480 Highlighted: $xmlAttributes = $xml->attributes(); Call to a member function attributes() on boolean in file controllers/admin/AdminThemesController.php at line 1480 protected function installTheme($themeDir, $sandbox = false, $redirect = true) 1472: { 1473: if ($this->tabAccess['add'] && $this->tabAccess['delete'] && !_PS_MODE_DEMO_) { 1474: $targetDir = _PS_ALL_THEMES_DIR_.$themeDir; 1475: 1476: if ($sandbox) { 1477: // Load configuration of the theme package. 1478: $sandboxDir = $sandbox.'/'.$themeDir; 1479: $xml = Theme::loadDefaultConfig($sandboxDir); 1480: $xmlAttributes = $xml->attributes(); 1481: $targetDir = _PS_ALL_THEMES_DIR_.$xmlAttributes['directory']; Edited April 15, 2020 by Theo Link to comment Share on other sites More sharing options...
AndyC Posted April 15, 2020 Share Posted April 15, 2020 Glad someone else is having issues .. I thought it was just me.. I, too, had the 500 page and gave up ..Although now have bits left over from removing 😞 Link to comment Share on other sites More sharing options...
Acer Posted April 15, 2020 Author Share Posted April 15, 2020 (edited) 9 minutes ago, AndyC said: Glad someone else is having issues .. I thought it was just me.. I, too, had the 500 page and gave up ..Although now have bits left over from removing 😞 Do you know that you can show the error detail on the 500 page? Because normally it's just blank with 500 error. And it doesn't give any detail. If you don't know: go to your sites folder/config and edit defines.inc.php. Change: define('_PS_MODE_DEV_', false); to define('_PS_MODE_DEV_', true); This will then show you the error detail, which you can post here Edited April 15, 2020 by Theo Link to comment Share on other sites More sharing options...
zen Posted April 15, 2020 Share Posted April 15, 2020 (edited) 34 minutes ago, Theo said: Ah spoke to soon... New error: Call to a member function attributes() on boolean line 1480 Highlighted: $xmlAttributes = $xml->attributes(); Call to a member function attributes() on boolean in file controllers/admin/AdminThemesController.php at line 1480 protected function installTheme($themeDir, $sandbox = false, $redirect = true) 1472: { 1473: if ($this->tabAccess['add'] && $this->tabAccess['delete'] && !_PS_MODE_DEMO_) { 1474: $targetDir = _PS_ALL_THEMES_DIR_.$themeDir; 1475: 1476: if ($sandbox) { 1477: // Load configuration of the theme package. 1478: $sandboxDir = $sandbox.'/'.$themeDir; 1479: $xml = Theme::loadDefaultConfig($sandboxDir); 1480: $xmlAttributes = $xml->attributes(); 1481: $targetDir = _PS_ALL_THEMES_DIR_.$xmlAttributes['directory']; What you can do is to test before and you won't get the error, like this on line 1480 : 1476: if ($sandbox) { 1477: // Load configuration of the theme package. 1478: $sandboxDir = $sandbox.'/'.$themeDir; 1479: $xml = Theme::loadDefaultConfig($sandboxDir); 1480: if (isset($xml->attributes())) $xmlAttributes = $xml->attributes(); 1481: $targetDir = _PS_ALL_THEMES_DIR_.$xmlAttributes['directory']; Edited April 15, 2020 by zen Link to comment Share on other sites More sharing options...
datakick Posted April 15, 2020 Share Posted April 15, 2020 42 minutes ago, Theo said: Ah spoke to soon... Sorry @datakick, need your help again please. New error: Call to a member function attributes() on boolean line 1480 Highlighted: $xmlAttributes = $xml->attributes(); Upgrade your tb to bleeding edge. This issue is already fixed there Link to comment Share on other sites More sharing options...
Acer Posted April 15, 2020 Author Share Posted April 15, 2020 3 minutes ago, datakick said: Upgrade your tb to bleeding edge. This issue is already fixed there Thanks @datakick, will do. Also thanks @zen Link to comment Share on other sites More sharing options...
Acer Posted April 15, 2020 Author Share Posted April 15, 2020 2 hours ago, datakick said: Upgrade your tb to bleeding edge. This issue is already fixed there Upgraded to Bleeding Edge, and sorted, thanks 👍 1 Link to comment Share on other sites More sharing options...
AndyC Posted May 7, 2020 Share Posted May 7, 2020 Hi I am attempting to change to this theme again now too I've done the datakick suggestion on line 1256-1257 and am attempting to upgrade to bleeding edge .. I have never dome this before so is the latest 1.1 or the issue -905 thanks Link to comment Share on other sites More sharing options...
toplakd Posted May 7, 2020 Share Posted May 7, 2020 Latest is 1.1.x (without issue number) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now