VirtueMart Forum
VirtueMart 2 + 3 => Virtuemart Development and bug reports => Topic started by: nsar on December 16, 2016, 12:58:11 pm
-
when i select configuration option all i get is 0 [] operator not supported for strings
is there a solution for that problem
thank you
-
?? http://forum.virtuemart.net/index.php?topic=104795.0
-
Same issue here with a fresh installation (full installer with VM3.0.17.8 on Joomla 3.6.2 => updated to VM 3.0.18 and Joomla 3.6.5 through Joomla's update manager).
PHP Version is 7.1, using docker's php7.1-apache image (Debian jessie-based).
Steps to reproduce:
- Log in to the Joomla backend
- Go to Virtuemart -> Configuration -> Configuration
- The error is shown:
"An error has occurred.
0 [] operator not supported for strings
Return to Control Panel"
I could not find anything in the Apache server logs or the VM logs in administrator/logs/.
The VM backend works in general, just the configuration page throws this error.
Best regards,
Reinhold
PS: If I enable "Debug System" in the Joomla config, then I get a backtrace:
Call stack
# Function Location
1 JApplicationCms->execute() /var/www/html/administrator/index.php:51
2 JApplicationAdministrator->doExecute() /var/www/html/libraries/cms/application/cms.php:261
3 JApplicationAdministrator->dispatch() /var/www/html/libraries/cms/application/administrator.php:152
4 JComponentHelper::renderComponent() /var/www/html/libraries/cms/application/administrator.php:98
5 JComponentHelper::executeComponent() /var/www/html/libraries/cms/component/helper.php:380
6 require_once() /var/www/html/libraries/cms/component/helper.php:405
7 JControllerLegacy->execute() /var/www/html/administrator/components/com_virtuemart/virtuemart.php:78
8 VmController->display() /var/www/html/libraries/legacy/controller/legacy.php:702
9 VirtuemartViewConfig->display() /var/www/html/administrator/components/com_virtuemart/helpers/vmcontroller.php:122
10 VirtueMartModelConfig->getNoImageList() /var/www/html/administrator/components/com_virtuemart/views/config/view.html.php:70
Comenting out the line 70 ($this->noimagelist = $model->getNoImageList(); ) and the line with currConverterList makes the configuration page load, but of course discards these two settings...
-
I found the culprit: in the config model, function getNoImageList was the following code:
function getNoImageList() {
[...]
$result = '';
foreach($dirs as $dir){
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != '.svn' && $file != 'index.html') {
if (filetype($dir.DS.$file) != 'dir') {
$result[] = JHtml::_('select.option', $file, vmText::_(str_replace('.php', '', $file)));
}
}
}
}
}
return $result;
}
The problem is that $result is set to an empty string and then appended to it like it was an array. Simply change line 208 to:
$result = array();
and a similar change to getCurrencyConverterList (line 233) in administrator/components/com_virtuemart/models/config.php and everything works.
This needs to be fixed in the VM core code by the VM developers.
Best regards,
Reinhold
-
I´ve had the same error after switching PHP from 7.0.14 to 7.1.0.
After the core hacks, virtuemart works fine.
Thanks!
VM 3.0.18 / Joomla 3.6.5 / PHP 7.1.0
-
Can confirm these changes fix the problem of VM config 3.0.18 on php7.1.0
//$result = '';
$result = array();
2 x on lines 208 & 235
-
Thank you for finding the culprit, I am sure there are more problems like this. Because it is a standard pattern, which worked from php5.3 -php7.0, seems that php7.1 breaks this quickndirty pattern.
The problem is that, it may need another line in the function calling getNoImageList to prevent problems in lower php versions.
-
Found the same issue on a new build when trying to view the shopping cart in the front end on PHP7.1.4 (works fine on 7.0.18).
J3.6.5 and 3.7.0, VM 3.2.1, PHP 7.1
-
I need the lines,.. the trace, something to find it. A bit more than "trying to view the shopping cart" would be nice.
-
That would be handy, yes sorry. I'll try again to get to them. Was nothing in the logs on the server or in admin logs.
edit: will try again over the weekend Milbo, release date is in a few days so must finish on PHP 7.0 and fork it to sort the issue.
-
Got this one in adminpanel when i try to disable shopperfields
0 Too few arguments to function VmController::toggle(), 0 passed in /home/***/***/libraries/legacy/controller/legacy.php on line 709 and at least 1 expected
-
PHP 7.1.4 on PHP 7.0.18 there is no problem
-
An error has occurred.
0 Too few arguments to function VmController::toggle(), 0 passed in /home/***/***/libraries/legacy/controller/legacy.php on line 709 and at least 1 expected
Call stack
# Function Location
1 VmController->toggle() JROOT/libraries/legacy/controller/legacy.php:709
2 JControllerLegacy->execute() JROOT/administrator/components/com_virtuemart/virtuemart.php:76
3 require_once() JROOT/libraries/cms/component/helper.php:394
4 JComponentHelper::executeComponent() JROOT/libraries/cms/component/helper.php:369
5 JComponentHelper::renderComponent() JROOT/libraries/cms/application/administrator.php:98
6 JApplicationAdministrator->dispatch() JROOT/libraries/cms/application/administrator.php:156
7 JApplicationAdministrator->doExecute() JROOT/libraries/cms/application/cms.php:265
8 JApplicationCms->execute() JROOT/administrator/index.php:51
-
is this still issue? i got this error on php 7.3 and latest vm 3.4.2
-
Some people have reported problems with PHP7.3 so it is advised to use no later than 7.2 currently.
-
Some people have reported problems with PHP7.3 so it is advised to use no later than 7.2 currently.
ok.. now i have it also on php 7.2.13.. so what version should i use?
it wont be fixed for all?
-
7.2 is fine.
-
7.2 is fine.
i dont have this option on hosting.. on none of the php versions i cant open the settings :'(
i can have 7.1.25, 7.2.13 or 7.3.0
what i can do? why important thing as this still dont work.. its issue from 2016?
-
7.2.13 == 7.2
they are sub versions
If u want the 0 [] operator not supported for strings fixed u need to do the research to find WHERE this is being thrown .. most of my sites are on php 7.3 and I haven't seen this error since all ( most? ) were found months ago
could just as easily be in a 3rd party plugin etc etc
-
Meanwhile it should also run on php7.3, if there are good bug reports, we can provide a fix. But the current main php version is php 7.2