News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

0 [] operator not supported for strings when selecting configuration option

Started by nsar, December 16, 2016, 12:58:11 PM

Previous topic - Next topic

nsar

when i select configuration option all i get is 0 [] operator not supported for strings

is there a solution for that problem

thank you

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

reinhold

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:

QuoteCall 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...

reinhold

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

Tiger78

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


GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

RobertL

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

Milbo

I need the lines,.. the trace, something to find it. A bit more than "trying to view the shopping cart" would be nice.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

RobertL

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.

HenrikS

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

HenrikS


HenrikS

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

jankoo

is this still issue? i got this error on php 7.3 and latest vm 3.4.2

jenkinhill

Some people have reported problems with PHP7.3 so it is advised to use no later than 7.2 currently.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum