Error operator not supported for strings operator not supported for strings joomla

Moderator: General Support Moderators

Moderator: General Support Moderators

quiquedcode

Joomla! Ace
Joomla! Ace
Posts: 1384
Joined: Thu Aug 18, 2005 10:11 pm
Location: San Juan — Argentina
Contact:

How to debug Error: [] operator not supported for strings

Hi
I’m about to smash my head agains the wall
I’ve upgraded to PHP 7.x in a shared hosting and now I can’t get out of this

Error: [] operator not supported for strings

I’ve read it is related to a php syntax change and now this causes that error.

1) I’ve set the php.ini error_reporting to E_ALL and the error does not show which file/line is causing it

2) I’ve disabled almost any 3rdparty extension in my site, without luck
https://imgur.com/4gvQoBb
Should I also delete/rename the disabled_extension’s folder?

3) I’ve latest Joomla!. Downloaded and overwrote again with standard install just in case, without luck

Does anyone know a secure method to detect where is this error being caused and patch it accordingly?

Thanks a lot in advance

Last edited by imanickam on Thu Jun 04, 2020 2:50 am, edited 1 time in total.

Reason: Moved topic » from General Questions/New to Joomla! 3.x to Templates for Joomla! 3.x


SharkyKZ

Joomla! Hero
Joomla! Hero
Posts: 2508
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: How to debug Error: [] operator not supported for strings

Post

by SharkyKZ » Tue Oct 23, 2018 5:33 am

Enable Debug in Global Configuration.


User avatar

Per Yngve Berg

Joomla! Master
Joomla! Master
Posts: 29659
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: How to debug Error: [] operator not supported for strings

Post

by Per Yngve Berg » Tue Oct 23, 2018 6:39 am

Raise the Error Report Level to ‘Developer’ in Global Configuration


quiquedcode

Joomla! Ace
Joomla! Ace
Posts: 1384
Joined: Thu Aug 18, 2005 10:11 pm
Location: San Juan — Argentina
Contact:

Re: How to debug Error: [] operator not supported for strings

Post

by quiquedcode » Wed Oct 24, 2018 12:17 am

Hi
I’ve solved with a forum post in rockettheme forums
The solution is to edit some code

file:
templatesrt_xxxhtmlmod_roknavmenuthemesgantry-fusionlayout.php)

Change these 3 lines from:

$wrapper_css = »;
$ul_css = »;
$group_css = »;

To:

$wrapper_css = array();
$ul_css = array();
$group_css = array();

Now the site works with PHP 7.x

Thanks


shenkwen

Joomla! Intern
Joomla! Intern
Posts: 96
Joined: Mon Sep 12, 2011 10:39 pm

Re: How to debug Error: [] operator not supported for strings

Post

by shenkwen » Tue Jul 30, 2019 1:41 pm

I’ve had this and solved it by uprading Gantry 4 to the latest version.

But what obsessed me is how come this error doesn’t give out filename and line number, it doesn’t even get logged into the error log. For this one I was lucky because I was able to guess it was gantry that caused the problem, but what if I can’t figure it out in the future? So what could be be preventing the error reporting mechanism from showing filename and line number is the more essential question.


User avatar

jjspelman

Joomla! Explorer
Joomla! Explorer
Posts: 279
Joined: Tue Apr 07, 2009 6:27 am
Location: Tampa, FL
Contact:

Re: How to debug Error: [] operator not supported for strings

Post

by jjspelman » Thu Jun 04, 2020 1:54 am

Thank you VERY MUCH for posting your solution to this problem. I had the very same issue with a Gantry template when updating to PHP 7.3 and no idea what happened. Many, many thanks!

When gantry is updated I hope it will update those 3 lines of code, lol.

quiquedcode wrote: ↑

Wed Oct 24, 2018 12:17 am


Hi
I’ve solved with a forum post in rockettheme forums
The solution is to edit some code

file:
templatesrt_xxxhtmlmod_roknavmenuthemesgantry-fusionlayout.php)

Change these 3 lines from:

$wrapper_css = »;
$ul_css = »;
$group_css = »;

To:

$wrapper_css = array();
$ul_css = array();
$group_css = array();

Now the site works with PHP 7.x

Thanks


User avatar

numinousmedia

Joomla! Ace
Joomla! Ace
Posts: 1567
Joined: Fri Dec 16, 2011 6:13 pm
Location: Barberton, OH
Contact:

Re: How to debug Error: [] operator not supported for strings

Post

by numinousmedia » Fri Jun 12, 2020 3:42 pm

Thanks quiquedcode, your recommendation worked for me as well after my PHP 7.3 upgrade.


User avatar

DanHouston

Joomla! Intern
Joomla! Intern
Posts: 77
Joined: Tue Oct 06, 2015 7:12 pm
Location: Houston, TX
Contact:

Re: How to debug Error: [] operator not supported for strings

Post

by DanHouston » Sat Mar 06, 2021 1:42 am

quiquedcode wrote: ↑

Wed Oct 24, 2018 12:17 am


Hi
I’ve solved with a forum post in rockettheme forums
The solution is to edit some code

file:
templatesrt_xxxhtmlmod_roknavmenuthemesgantry-fusionlayout.php)

Change these 3 lines from:

$wrapper_css = »;
$ul_css = »;
$group_css = »;

To:

$wrapper_css = array();
$ul_css = array();
$group_css = array();

Now the site works with PHP 7.x

Thanks

That just worked for me but the file path was templates/gantry/html/mod_roknavmenu/themes/gantry-dropdown/layout.php

THANKS SO MUCH!

Meeseeks are not born into this world fumbling for meaning! We are created to serve a singular purpose — building Joomla! sites — which we will go to any lengths to fulfill!


daffodilistic

Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon May 17, 2021 2:36 am

Re: How to debug Error: [] operator not supported for strings

Post

by daffodilistic » Mon May 17, 2021 2:41 am

quiquedcode wrote: ↑

Wed Oct 24, 2018 12:17 am


Hi
I’ve solved with a forum post in rockettheme forums
The solution is to edit some code

file:
templatesrt_xxxhtmlmod_roknavmenuthemesgantry-fusionlayout.php)

Change these 3 lines from:

Code: Select all

$wrapper_css = '';
$ul_css = '';
$group_css = '';

To:

Code: Select all

$wrapper_css = array();
$ul_css = array();
$group_css = array();

Now the site works with PHP 7.x

Thanks

For my theme template, I only needed to change

No need to change others.



Return to “Templates for Joomla! 3.x”


Jump to

  • Joomla! Announcements
  • ↳   Announcements
  • ↳   Announcements Discussions
  • Joomla! 4.x — Ask Support Questions Here
  • ↳   General Questions/New to Joomla! 4.x
  • ↳   Installation Joomla! 4.x
  • ↳   Administration Joomla! 4.x
  • ↳   Migrating and Upgrading to Joomla! 4.x
  • ↳   Extensions for Joomla! 4.x
  • ↳   Security in Joomla! 4.x
  • ↳   Templates for Joomla! 4.x
  • ↳   Search Engine Optimization (Joomla! SEO) in Joomla! 4.x
  • ↳   Language — Joomla! 4.x
  • ↳   Performance — Joomla! 4.x
  • ↳   Joomla! 4.x Coding
  • Joomla! 3.x — Ask Support Questions Here
  • ↳   General Questions/New to Joomla! 3.x
  • ↳   Installation Joomla! 3.x
  • ↳   Joomla! 3.x on IIS webserver
  • ↳   Administration Joomla! 3.x
  • ↳   Access Control List (ACL) in Joomla! 3.x
  • ↳   Migrating and Upgrading to Joomla! 3.x
  • ↳   Security in Joomla! 3.x
  • ↳   Extensions for Joomla! 3.x
  • ↳   Templates for Joomla! 3.x
  • ↳   Search Engine Optimization (Joomla! SEO) in Joomla! 3.x
  • ↳   Language — Joomla! 3.x
  • ↳   Performance — Joomla! 3.x
  • ↳   Joomla! 3.x Coding
  • Joomla! Versions which are End of Life
  • ↳   Joomla! 2.5 — End of Life 31 Dec 2014
  • ↳   General Questions/New to Joomla! 2.5
  • ↳   Installation Joomla! 2.5
  • ↳   Joomla! 2.5 on IIS webserver
  • ↳   Administration Joomla! 2.5
  • ↳   Access Control List (ACL) in Joomla! 2.5
  • ↳   Migrating and Upgrading to Joomla! 2.5
  • ↳   Security in Joomla! 2.5
  • ↳   Extensions for Joomla! 2.5
  • ↳   Templates for Joomla! 2.5
  • ↳   Search Engine Optimization (Joomla! SEO) in Joomla! 2.5
  • ↳   Language — Joomla! 2.5
  • ↳   Performance — Joomla! 2.5
  • ↳   Joomla! 1.5 — End of Life Sep 2012
  • ↳   General Questions/New to Joomla! 1.5
  • ↳   Installation 1.5
  • ↳   Joomla! 1.5 on IIS webserver
  • ↳   Administration 1.5
  • ↳   Migrating and Upgrading to Joomla! 1.5
  • ↳   Security in Joomla! 1.5
  • ↳   Extensions for Joomla! 1.5
  • ↳   Templates for Joomla! 1.5
  • ↳   Search Engine Optimization (Joomla! SEO) in Joomla! 1.5
  • ↳   Language — Joomla! 1.5
  • ↳   Performance — Joomla! 1.5
  • ↳   Joomla! 1.0 — End of Life 22 July 2009
  • ↳   Installation — 1.0.x
  • ↳   Upgrading — 1.0.x
  • ↳   Security — 1.0.x
  • ↳   3rd Party/Non Joomla! Security Issues
  • ↳   Administration — 1.0.x
  • ↳   Extensions — 1.0.x
  • ↳   Components
  • ↳   Modules
  • ↳   Plugins/Mambots
  • ↳   WYSIWYG Editors — 1.0.x
  • ↳   Integration & Bridges — 1.0.x
  • ↳   phpbb — Joomla! Integration
  • ↳   Templates & CSS — 1.0.x
  • ↳   Language — 1.0.x
  • ↳   Joom!Fish and Multilingual Sites
  • ↳   Performance — 1.0.x
  • ↳   General Questions — 1.0.x
  • Joomla! International Language Support
  • ↳   International Zone
  • ↳   Arabic Forum
  • ↳   تنبيهات هامة
  • ↳   الدروس
  • ↳   4.x جوملا!
  • ↳   جوملا! 1.6/1.7
  • ↳   الأسئلة الشائعة
  • ↳   التثبيت و الترقية
  • ↳   الحماية — و تحسين السرعة والأداء
  • ↳   لوحة التحكم
  • ↳   الإضافات البرمجية
  • ↳   تعريب جوملا! و الإضافات البرمجية
  • ↳   القوالب و التصميم
  • ↳   صداقة محركات البحث
  • ↳   القسم العام
  • ↳   1.5 !جوملا
  • ↳   الأسئلة الشائعة
  • ↳   التثبيت و الترقية
  • ↳   الحماية — و تحسين السرعة والأداء
  • ↳   لوحة التحكم
  • ↳   الإضافات البرمجية
  • ↳   تعريب جوملا! و الإضافات البرمجية
  • ↳   القوالب و التصميم
  • ↳   صداقة محركات البحث
  • ↳   القسم العام
  • ↳   جوملا! 1.0
  • ↳   الأسئلة الشائـعة
  • ↳   التثبيت
  • ↳   لوحة التحكم
  • ↳   الإضافات البرمجية
  • ↳   الإضافات المعرّبة
  • ↳   القوالب و التصميم
  • ↳   الحماية — تحسين السرعة والأداء — صداقة محركات البحث
  • ↳   القسم العام
  • ↳   القسم العام
  • ↳   !عرض موقعك بجوملا
  • ↳   الأرشيف
  • ↳   Bengali Forum
  • ↳   Bosnian Forum
  • ↳   Joomla! 1.5
  • ↳   Instalacija i prvi koraci
  • ↳   Ekstenzije
  • ↳   Templejti
  • ↳   Moduli
  • ↳   Prevodi i dokumentacija
  • ↳   Joomla! 1.7 / Joomla! 1.6
  • ↳   Catalan Forum
  • ↳   Notícies
  • ↳   Temes sobre l’administració
  • ↳   Temes sobre la traducció
  • ↳   Components, mòduls i joombots
  • ↳   Temes de disseny
  • ↳   Webs realitzades amb Joomla!
  • ↳   Offtopics
  • ↳   Chinese Forum
  • ↳   Croatian Forum
  • ↳   Danish Forum
  • ↳   Meddelelser
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x (Anbefalet til nye installationer. Nyeste funktionalitet)
  • ↳   Installation, backup, opdatering og flytning — Godt igang
  • ↳   Administration — Generel brug
  • ↳   Komponenter, Moduler og Plugins
  • ↳   Template, CSS og Design
  • ↳   Nethandel, betaling m.m.
  • ↳   Ældre versioner (disse vedligeholdes ikke længere fra officiel side)
  • ↳   Joomla! 2.5 (Supporteres indtil 31. dec. 2014)
  • ↳   Installation, backup, opdatering og flytning — Godt igang
  • ↳   Administration — Generel brug
  • ↳   Komponenter, Moduler og Plugins
  • ↳   Template, CSS og Design
  • ↳   Nethandel, betaling m.m.
  • ↳   Joomla 1.5 (Tidligere langtidssupporteret version indtil sep. 2012)
  • ↳   Installation, backup, opdatering og flytning — Godt igang
  • ↳   Administration — Generel brug
  • ↳   Komponenter, Moduler og Plugins
  • ↳   Template, CSS og Design
  • ↳   Nethandel, betaling m.m.
  • ↳   Joomla 1.0 (Udgået version, der blev afløst af 1.5 i 2008)
  • ↳   Installation, backup, opdatering og flytning — Godt igang
  • ↳   Administration — Generel brug
  • ↳   Komponenter, Moduler og Mambots
  • ↳   Template, CSS og Design
  • ↳   Nethandel, betaling m.m.
  • ↳   Oversættelser (lokalisering)
  • ↳   Joomla brugergrupper i Danmark
  • ↳   JUG Kolding
  • ↳   JUG København
  • ↳   JUG Odense
  • ↳   JUG Århus
  • ↳   JUG Sorø
  • ↳   Kommerciel (betalt) hjælp ønskes
  • ↳   SEO
  • ↳   FAQ — Dokumentation og vejledninger
  • ↳   Vis dit websted
  • ↳   Afviste ‘Vis dit websted’ indlæg
  • ↳   Diverse (Off topic)
  • ↳   Dutch Forum
  • ↳   Aankondigingen
  • ↳   Algemene vragen
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Installatie 3.x
  • ↳   Extensies 3.x
  • ↳   Templates 3.x
  • ↳   Joomla! 2.5
  • ↳   Installatie 2.5
  • ↳   Componenten 2.5
  • ↳   Modules 2.5
  • ↳   Plugins 2.5
  • ↳   Templates 2.5
  • ↳   Joomla! 1.5
  • ↳   Installatie
  • ↳   Componenten
  • ↳   Modules
  • ↳   Plugins
  • ↳   Templates
  • ↳   Joomla! 1.0
  • ↳   Installatie 1.0.x
  • ↳   Componenten 1.0.x
  • ↳   Modules 1.0.x
  • ↳   Mambots 1.0.x
  • ↳   Templates 1.0.x
  • ↳   Vertalingen
  • ↳   Offtopic
  • ↳   Show jouw website
  • ↳   Filipino Forum
  • ↳   International Support Center
  • ↳   Pinoy General Discussion & Archives
  • ↳   Site Showcase
  • ↳   Events
  • ↳   Design Tips and Tricks
  • ↳   Tsismis Zone
  • ↳   Pinoy Translation Zone
  • ↳   Pinoy Forum Archives
  • ↳   Joomla! Philippines Local Forum www.joomla.org.ph
  • ↳   Finnish Forum
  • ↳   French Forum
  • ↳   Les annonces!
  • ↳   Le bistrot!
  • ↳   L’expo!
  • ↳   J! 4.x — L’atelier!
  • ↳   J! 3.x — L’atelier!
  • ↳   3.x — Questions générales, nouvel utilisateur
  • ↳   3.x — Installation, migration et mise à jour
  • ↳   3.x — Sécurité et performances
  • ↳   3.x — Extensions tierce partie
  • ↳   3.x — Templates et design
  • ↳   3.x — Développement
  • ↳   3.x — Ressources
  • ↳   J! 2.5.x — L’atelier!
  • ↳   2.5 — Questions générales
  • ↳   2.5 — Installation, migration et mise à jour
  • ↳   2.5 — Sécurité et performances
  • ↳   2.5 — Extensions tierce partie
  • ↳   2.5 — Templates et design
  • ↳   2.5 — Développement
  • ↳   2.5 — Ressources
  • ↳   J! 1.5.x — L’atelier!
  • ↳   1.5 — Questions générales
  • ↳   1.5 — Installation, migration et mise à jour
  • ↳   1.5 — Sécurité et performances
  • ↳   1.5 — Extensions tierce partie
  • ↳   1.5 — Templates et design
  • ↳   1.5 — Développement
  • ↳   1.5 — Ressources
  • ↳   J! 1.0.x — L’atelier!
  • ↳   1.0 — Questions générales
  • ↳   1.0 — Installation et mise à jour
  • ↳   1.0 — Sécurité
  • ↳   1.0 — Extensions tierce partie
  • ↳   1.0 — Templates et design
  • ↳   1.0 — Développement
  • ↳   1.0 — Ressources
  • ↳   Besoin d’un professionel ?
  • ↳   Extensions Open Source pour Joomla!
  • ↳   German Forum
  • ↳   Ankündigungen
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Allgemeine Fragen
  • ↳   Installation und erste Schritte
  • ↳   Komponenten, Module, Plugins
  • ↳   Template, CSS und Designfragen
  • ↳   Entwicklerforum
  • ↳   Zeige Deine Webseite
  • ↳   Joomla! 2.5
  • ↳   Allgemeine Fragen
  • ↳   Installation und erste Schritte
  • ↳   Komponenten, Module, Plugins
  • ↳   Template, CSS und Designfragen
  • ↳   Entwicklerforum
  • ↳   Zeige Deine Webseite
  • ↳   Joomla! 1.5
  • ↳   Allgemeine Fragen
  • ↳   Installation und erste Schritte
  • ↳   Komponenten, Module, Plugins
  • ↳   Template, CSS und Designfragen
  • ↳   Entwicklerforum
  • ↳   Zeige Deine Webseite
  • ↳   Professioneller Service
  • ↳   Sonstiges (Offtopic)
  • ↳   Archiv
  • ↳   Joomla! 1.0
  • ↳   Allgemeine Fragen 1.0.x
  • ↳   Installation und erste Schritte 1.0.x
  • ↳   Komponenten, Module, Mambots 1.0.x
  • ↳   Template, CSS und Designfragen 1.0.x
  • ↳   Entwicklerforum 1.0.x
  • ↳   Zeige Deine Webseite 1.0.x
  • ↳   Greek Forum
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Joomla! 2.5.x
  • ↳   Joomla! 1.5.x
  • ↳   Joomla! 1.0.x
  • ↳   Hebrew Forum
  • ↳   Indic Languages Forum
  • ↳   Indonesian Forum
  • ↳   FAQ
  • ↳   Bantuan
  • ↳   Komponen
  • ↳   Modul
  • ↳   Template
  • ↳   Diskusi
  • ↳   Italian Forum
  • ↳   Guide
  • ↳   Traduzioni
  • ↳   Componenti — Moduli — Plugins
  • ↳   Template — Grafica
  • ↳   Notizie
  • ↳   Prodotti Open Source per Joomla!
  • ↳   Richieste professionali
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Joomla! 2.5.x
  • ↳   Joomla! 1.x
  • ↳   Latvian Forum
  • ↳   Lithuanian Forum
  • ↳   Joomla! 4.x
  • ↳   Joomla! 1.5
  • ↳   Joomla! 1.7 / Joomla! 1.6
  • ↳   Joomla! 1.0
  • ↳   Vertimai ir Kalba
  • ↳   Malaysian Forum
  • ↳   Solved
  • ↳   Norwegian Forum
  • ↳   Informasjon
  • ↳   Arkiverte annonseringer
  • ↳   FAQ — Ofte spurte spørsmål
  • ↳   Arkiv
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Administrasjon/installasjon
  • ↳   Migrering/Oppdatering
  • ↳   Template, CSS og design
  • ↳   Komponenter/moduler/programutvidelser
  • ↳   Sikkerhet
  • ↳   Generelt
  • ↳   Netthandel, betaling m.m.
  • ↳   VirtueMart
  • ↳   Andre nettbutikkløsninger
  • ↳   Generelt
  • ↳   Oversettelser
  • ↳   Fremvisning av sider (Show off)
  • ↳   Avviste fremvisninger
  • ↳   Diverse (off topic)
  • ↳   Kommersiell hjelp ønskes
  • ↳   Eldre versjoner av Joomla!
  • ↳   Joomla! 1.0
  • ↳   Administrasjon/installasjon
  • ↳   Template, CSS og design
  • ↳   Komponenter/moduler/mambots
  • ↳   Sikkerhet
  • ↳   Generelt
  • ↳   Joomla! 1.5
  • ↳   Administrasjon/installasjon
  • ↳   Migrering/Oppdatering
  • ↳   Template, CSS og design
  • ↳   Komponenter/moduler/programutvidelser
  • ↳   Sikkerhet
  • ↳   Generelt
  • ↳   Joomla! 2.5
  • ↳   Administrasjon/installasjon
  • ↳   Migrering/Oppdatering
  • ↳   Template, CSS og design
  • ↳   Komponenter/moduler/programutvidelser
  • ↳   Sikkerhet
  • ↳   Generelt
  • ↳   Persian Forum
  • ↳   قالب ها
  • ↳   مدیریت
  • ↳   سوالهای عمومی
  • ↳   نصب
  • ↳   مامبوت ها
  • ↳   ماژولها
  • ↳   کامپوننت ها
  • ↳   Polish Forum
  • ↳   Instalacja i aktualizacja
  • ↳   Administracja
  • ↳   Komponenty, moduły, wtyczki
  • ↳   Szablony
  • ↳   Paczta i Podziwiajta
  • ↳   Modyfikacje i własne rozwiązania
  • ↳   Tłumaczenia
  • ↳   FAQ
  • ↳   Tips&Tricks
  • ↳   Dokumentacja
  • ↳   Profesjonalne usługi
  • ↳   Portuguese Forum
  • ↳   Componentes, módulos e mambots
  • ↳   Programação e desenvolvimento
  • ↳   Segurança
  • ↳   Sites dos usuários
  • ↳   Off-topic
  • ↳   Tradução
  • ↳   Templates
  • ↳   Romanian Forum
  • ↳   Traduceri
  • ↳   Russian Forum
  • ↳   Объявления по Joomla!
  • ↳   Безопасность Joomla!
  • ↳   Joomla 4.x — Задайте здесь свой вопрос по поддержке
  • ↳   Joomla 3.x — Задайте здесь свой вопрос по поддержке
  • ↳   Общие вопросы/Новичок в Joomla! 3.x
  • ↳   Установка Joomla! 3.x
  • ↳   Миграция и переход на Joomla! 3.x
  • ↳   Расширения для Joomla! 3.x
  • ↳   Многоязычные веб-сайты на Joomla 3.x
  • ↳   Joomla 2.5 — Задайте здесь свой вопрос по поддержке
  • ↳   Общие вопросы/Новичок в Joomla! 2.5
  • ↳   Установка Joomla! 2.5
  • ↳   Расширения для Joomla! 2.5
  • ↳   Русский язык Joomla! 2.5
  • ↳   Serbian/Montenegrin Forum
  • ↳   Tehnička pitanja
  • ↳   Instalacija i početnička pitanja
  • ↳   Šabloni
  • ↳   Prevod i dokumentacija
  • ↳   Ćaskanje
  • ↳   Bezbednost
  • ↳   Joomla! dodaci
  • ↳   Pravna pitanja
  • ↳   Arhiva
  • ↳   Joomla! Događaji i Zajednica
  • ↳   Izlog (spisak) sajtova radjenih u Joomla! CMS-u
  • ↳   Profesionalne usluge
  • ↳   Slovak Forum
  • ↳   Spanish Forum
  • ↳   Joomla! 4.x
  • ↳   Joomla! 3.x
  • ↳   Migración y actualización a Joomla 3.x
  • ↳   Versiones de Joomla! obsoletas
  • ↳   Joomla! 2.5
  • ↳   Joomla! 1.5
  • ↳   Extensiones
  • ↳   Plantillas (templates) y diseño
  • ↳   Idioma y traducciones
  • ↳   SEO para Joomla!
  • ↳   Seguridad y rendimiento
  • ↳   Productos de Código Abierto para Joomla!
  • ↳   Servicios profesionales
  • ↳   Salón de la comunidad Ñ
  • ↳   Swedish Forum
  • ↳   Meddelanden
  • ↳   Forum Joomla! 4.x
  • ↳   Forum Joomla! 3.x
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och plugin
  • ↳   Mallar (templates) och design
  • ↳   Äldre versioner
  • ↳   Forum Joomla! 1.0
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och Mambots
  • ↳   Mallar (templates) och design
  • ↳   Forum Joomla! 1.7 / Joomla! 1.6
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och plugin
  • ↳   Mallar (templates) och design
  • ↳   Forum Joomla! 1.5
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och plugin
  • ↳   Mallar (templates) och design
  • ↳   Forum Joomla! 2.5
  • ↳   Allmänna frågor
  • ↳   Användning och administration
  • ↳   Installation, backup och säkerhet
  • ↳   Komponenter, moduler och plugin
  • ↳   Mallar (templates) och design
  • ↳   Översättning
  • ↳   Webbplatser gjorda i Joomla
  • ↳   Webbplatser J! 3.x
  • ↳   Webbplatser J! 2.5
  • ↳   Webbplatser Joomla! 1.7 / Joomla! 1.6
  • ↳   Webbplatser J! 1.5
  • ↳   Webbplatser J! 1.0
  • ↳   Kommersiell hjälp önskas
  • ↳   Diverse (off topic)
  • ↳   Tamil Forum
  • ↳   Thai Forum
  • ↳   โชว์เว็บไซต์ของคุณที่สร้างด้วยจูมล่า
  • ↳   เคล็ดลับการใช้งานส่วนต่างๆ เกี่ยวกับจ&#
  • ↳   คอมโพเน้นท์ โมดูล ปลักอิน ต่างๆ ที่ติดตั
  • ↳   อับเดดข่าวสารเกี่ยวกับจูมล่าลายไทย
  • ↳   Turkish Forum
  • ↳   Duyurular
  • ↳   Dersler
  • ↳   Genel Sorular
  • ↳   Bileşen, Modül, Bot
  • ↳   Eklenti Haberleri
  • ↳   Temalar
  • ↳   Vietnamese Forum
  • ↳   Gặp gỡ và giao lưu
  • ↳   Joomla Tiếng Việt
  • ↳   Cài đặt — Cấu hình
  • ↳   Thành phần mở rộng cho Joomla!
  • ↳   Hỏi đáp Joomla! 3.x
  • ↳   Hỏi đáp Joomla! 2.5
  • ↳   Hỗ trợ kỹ thuật
  • ↳   Bài viết cũ
  • ↳   Thiết kế Template
  • ↳   Joomla! 1.5
  • ↳   Hỏi đáp Joomla! 4.x
  • ↳   Welsh Forum
  • Other Forums
  • ↳   Open Source Products for Joomla!
  • ↳   The Lounge
  • ↳   Forum Post Assistant (FPA)
  • Joomla! Development Forums
  • Joomla! Official Sites & Infrastructure
  • ↳   docs.joomla.org — Feedback/Information
  • ↳   extensions.joomla.org — Feedback/Information
  • ↳   joomla.com — Feedback/Information
  • ↳   Sites & Infrastructure — Feedback/Information
  • ↳   Archived Boards — All boards closed
  • ↳   Design and Accessibility — Archived
  • ↳   Quality and Testing — Locked and Archived
  • ↳   Joomla! 1.0.x_Q&T
  • ↳   Q&T 1.0.x Resolved
  • ↳   Known Issues
  • ↳   Superseded Issues
  • ↳   Archive
  • ↳   Q&T 1.0.x Resolved — Archived
  • ↳   Known Issues — Archive
  • ↳   Superseded Issues — Archive
  • ↳   Joomla! 3.x Bug Reporting
  • ↳   Third Party Testing for Joomla! 1.5
  • ↳   Q&T 1.5.x Resolved
  • ↳   Joomla! 1.5 BETA
  • ↳   Joomla! 1.5 BETA 2
  • ↳   Reaction to the ‘Letter to the community’
  • ↳   Reaction to New Project Name
  • ↳   Logo Competition
  • ↳   Humor, Fun and Games
  • ↳   Libraries
  • ↳   patTemplate
  • ↳   com_connector — Multi Joomla Bridge
  • ↳   CiviCRM Support
  • ↳   CiviCRM Installation Issues
  • ↳   FAQ Archive
  • ↳   FAQ Discussion Board
  • ↳   3rd Party Extensions FAQ
  • ↳   FAQs not moved
  • ↳   3rd Party/Non Joomla! Security FAQ
  • ↳   Joomla! Coding 101
  • ↳   Joombie Tools of the Trade
  • ↳   Joombie Coding Q/A
  • ↳   Joombie Think Tank
  • ↳   Joombie Developer Lab
  • ↳   Joomla Forge — Archived
  • ↳   Non-Profit Organizations and Joomla!
  • ↳   Schools and Universities
  • ↳   Bangsamoro Forum
  • ↳   Joomla! 1.5 Template Contest
  • ↳   SMF — Simplemachines.org Forum
  • ↳   GPL Discussion
  • ↳   Security Announcements — Old
  • ↳   Tips & Tricks — Moving
  • ↳   Submit Your Suggested Tips & Tricks to Docs.joomla.org now please.
  • ↳   Google Summer of Code and GHOP
  • ↳   Google Summer of Code 2008
  • ↳   Proposed projects
  • ↳   Student area
  • ↳   Past Google Summer of Code Editions
  • ↳   Google’s Highly Open Participation Contest
  • ↳   Documentation
  • ↳   Suggestions, Modifications, and Corrections
  • ↳   Archive
  • ↳   1.5 Archive
  • ↳   Suggestions, Modifications & Corrections
  • ↳   Submit
  • ↳   Feedback and Suggestions
  • ↳   Applications for participation in the Development Workgroup
  • ↳   Development
  • ↳   1.5 Site Showcase — Archived
  • ↳   1.0 x Site Showcase — Archived.
  • ↳   Feature Requests — White Papers — Archived
  • ↳   Under Review — Archived
  • ↳   Accepted — Archived
  • ↳   Not Accepted — Archived
  • ↳   Wishlists and Feature Requests — Archive
  • ↳   Wishlist Archives — Archived
  • ↳   Spanish Forum — Archive
  • ↳   Papelera
  • ↳   Tutoriales
  • ↳   General
  • ↳   Salón de la Joomlaesfera hispanohablante
  • ↳   Danish Forum — Archive
  • ↳   Diskussion af Meddelelser + Sikkerhedsmeddelelser + FAQ
  • ↳   Shop.Joomla.org
  • ↳   Joomla! 1.6 RC Support [closed]
  • ↳   Joomla! 1.0 Coding
  • ↳   Core Hacks and Patches
  • ↳   Joomla! 2.5 Beta Support
  • ↳   People.joomla.org — Feedback/Information
  • ↳   Joomla! 1.5 Bug Reporting
  • ↳   Joomla! 1.5 Coding
  • ↳   Joomla! 3 Beta Support
  • ↳   Trending Topics
  • ↳   Help wanted in the community
  • ↳   templates.joomla.org — Feedback/Information
  • ↳   Certification
  • ↳   Albanian Forum
  • ↳   Azeri Forum
  • ↳   Urdu Forum
  • ↳   Basque Forum
  • ↳   Itzulpenaren inguruan
  • ↳   Laguntza teknikoa
  • ↳   Belarusian Forum
  • ↳   Maltese Forum
  • ↳   Hungarian Forum
  • ↳   Slovenian Forum
  • ↳   Japanese Forum
  • ↳   Khmer Forum
  • ↳   ពិពណ៌​ស្ថាន​បណ្ដាញ​ជុំឡា
  • ↳   ជុំឡា​ខ្មែរ​មូលដ្ឋានីយកម្ម
  • ↳   Community Blog Discussions
  • ↳   JoomlaCode.org
  • ↳   Joomla! Marketing and PR Team
  • ↳   resources.joomla.org — Feedback/Information
  • ↳   Training.Joomla.org
  • ↳   OpenSourceMatters.org
  • ↳   magazine.joomla.org — Feedback/Information
  • ↳   Site Showcase
  • ↳   Joomla! 4 Related
  • ↳   Joomla! Events
  • ↳   Joomla! Ideas Forum
  • ↳   Registered Joomla! User Groups
  • ↳   Joomla! 2.5 Coding
  • ↳   Joomla! 2.5 Bug Reporting
  • ↳   User eXperience (UX)
  • ↳   Joomla! Working Groups
  • ↳   Translations

With PHP 7.1, some PHP web applications fail because of deprecated code usage. This may result in an error message like [] operator not supported for strings for various Joomla, WordPress and Drupal components. Here’s how to fix this code for PHP 7.1+.

I’ll use Joomla as an example in this short post. The same error and fix may apply for other CMS systems like WordPress and Drupal.

First you have to enable Joomla Debug modus, that’ll show you where the error is happening. Open up configuration.php and set public $debug to 1.

If you refresh the page now, you’ll see Joomla’s error page, telling you about Fatal error: Uncaught Error:

Fatal error: Uncaught Error: [] operator not supported for strings D:wwwexample.comwwwcomponentscom_layer_sliderbaseincludesslider_markup_init.php:98

OK, so we now know where the error is, it’s on line 98 in com_layer_slider’s baseincludesslider_markup_init.php file. In this case, the failing code is:

$data = '<script type="text/javascript">' . NL;

Code language: PHP (php)

You can fix this PHP error by first initializing $data[] as an array:

$data = []; $data[] = '<script type="text/javascript">' . NL;

Code language: PHP (php)

A second method is to use the older style using array():

$data = array(); $data[] = '<script type="text/javascript">' . NL;

Code language: PHP (php)

Let’s hope not too many Joomla components, plugins and extensions use code like this. Not to mention other CMS systems like Expression Engine, WordPress, BuddyPress, PrestaShop…

Update 3-3-2018:
WordPress premium Betheme theme by Muffin group needs a fix in the file

wp-contentthemesbethemefunctionsbuilderfront.php

Code language: PHP (php)

On line 150:

// $section_style = ''; $section_style = [];

Code language: PHP (php)

WordPress Revolution Slider

Older versions of WordPress plugin Revolution Slider by ThemePunch has this same deprecated PHP code, and throws an error:

Uncaught Error: [] operator not supported for strings in wp-contentpluginsrevsliderincludesframeworkbase-admin.class.php:69

To fix this, add a line before line 69:

self::$arrMetaBoxes = []; # add this line to create the variable as an array self::$arrMetaBoxes[] = $box;

Code language: PHP (php)

0 [] operator not supported for strings   
/home/o/obeliskkam/new/public_html/administrator/components/com_uniterevolution2/inc_php/framework/base_admin.class.php:70
На эту строчку ругается

/**
*
* add some meta box
* return metabox handle
*/
public static function addMetaBox($title,$content = null, $customDrawFunction = null,$location="post"){

$box = array();
$box["title"] = $title;
$box["location"] = $location;
$box["content"] = $content;
$box["draw_function"] = $customDrawFunction;

self::$arrMetaBoxes[] = $box;
}

<?php

  class UniteBaseAdminClassRev extends UniteBaseClassRev{

  const ACTION_ADMIN_MENU = "admin_menu";
const ACTION_ADMIN_INIT = "admin_init";
const ACTION_ADD_SCRIPTS = "admin_enqueue_scripts";
const ACTION_ADD_METABOXES = "add_meta_boxes";
const ACTION_SAVE_POST = "save_post";

const ROLE_ADMIN = "admin";
const ROLE_EDITOR = "editor";
const ROLE_AUTHOR = "author";

protected static $master_view;
protected static $view;

private static $arrSettings = array();
private static $arrMenuPages = array();
private static $tempVars = array();
private static $startupError = "";
private static $menuRole = self::ROLE_ADMIN;
private static $arrMetaBoxes = ""; //option boxes that will be added to post

/**
*
* main constructor
*/
public function __construct($mainFile,$t,$defaultView){

parent::__construct($mainFile,$t);

//set view
self::$view = self::getGetVar("view");
if(empty(self::$view))
self::$view = $defaultView;

//add internal hook for adding a menu in arrMenus
self::addAction(self::ACTION_ADMIN_MENU, "addAdminMenu");
self::addAction(self::ACTION_ADD_METABOXES, "onAddMetaboxes");
self::addAction(self::ACTION_SAVE_POST, "onSavePost");

//if not inside plugin don't continue
if($this->isInsidePlugin() == true){
self::addAction(self::ACTION_ADD_SCRIPTS, "addCommonScripts");
self::addAction(self::ACTION_ADD_SCRIPTS, "onAddScripts");
}

//a must event for any admin. call onActivate function.
$this->addEvent_onActivate();
self::addActionAjax("show_image", "onShowImage");

self::addCommonScripts();
}

/**
*
* add some meta box
* return metabox handle
*/
public static function addMetaBox($title,$content = null, $customDrawFunction = null,$location="post"){

$box = array();
$box["title"] = $title;
$box["location"] = $location;
$box["content"] = $content;
$box["draw_function"] = $customDrawFunction;

self::$arrMetaBoxes[] = $box;
}

/**
*
* on add metaboxes
*/
public static function onAddMetaboxes(){

foreach(self::$arrMetaBoxes as $index=>$box){

$title = $box["title"];
$location = $box["location"];

$boxID = "mymetabox_".self::$dir_plugin.'_'.$index;
$function = array(self::$t, "onAddMetaBoxContent");

if(is_array($location)){
foreach($location as $loc)
add_meta_box($boxID,$title,$function,$loc,'normal','default');
}else
    add_meta_box($boxID,$title,$function,$location,'normal','default');
}
}

/**
*
* on save post meta. Update metaboxes data from post, add it to the post meta
*/
public static function onSavePost(){

//protection against autosave
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ){
$postID = UniteFunctionsRev::getPostVariable("ID");
        return $postID;
}

$postID = UniteFunctionsRev::getPostVariable("ID");
if(empty($postID))
return(false);

foreach(self::$arrMetaBoxes as $box){
$content = UniteFunctionsRev::getVal($box, "content");
if(gettype($content) != "object")
continue;

$arrSettingNames = $content->getArrSettingNames();
foreach($arrSettingNames as $name){
$value = UniteFunctionsRev::getPostVariable($name);
update_post_meta( $postID, $name, $value );
} //end foreach settings

} //end foreach meta

}

/**
*
* on add metabox content
*/
public static function onAddMetaBoxContent($post,$boxData){

$postID = $post->ID;

$boxID = UniteFunctionsRev::getVal($boxData, "id");
$index = str_replace("mymetabox_".self::$dir_plugin.'_',"",$boxID);

$arrMetabox = self::$arrMetaBoxes[$index];

$content = UniteFunctionsRev::getVal($arrMetabox, "content");

$contentType = getType($content);
switch ($contentType){
case "string":
echo $content;
break;
default: //settings object
$output = new UniteSettingsProductSidebarRev();
$output->setDefaultInputClass(UniteSettingsProductSidebarRev::INPUT_CLASS_LONG);
$content->updateValuesFromPostMeta($postID);
$output->init($content);

//draw element
$drawFunction = UniteFunctionsRev::getVal($arrMetabox, "draw_function");
if(!empty($drawFunction))
call_user_func($drawFunction,$output);
else
$output->draw();

break;
}

}

/**
*
* set the menu role - for viewing menus
*/
public static function setMenuRole($menuRole){
self::$menuRole = $menuRole;
}

/**
*
* set startup error to be shown in master view
*/
public static function setStartupError($errorMessage){
self::$startupError = $errorMessage;
}

/**
*
* tells if the the current plugin opened is this plugin or not
* in the admin side.
*/
private function isInsidePlugin(){
$page = self::getGetVar("page");
if($page == self::$dir_plugin)
return(true);
return(false);
}

/**
*
* add common used scripts
*/
public static function addCommonScripts(){

$isJoomla3 = UniteFunctionJoomlaRev::isJoomla3();

$urlJQuery = "https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js";

if($isJoomla3 == false){
self::addScriptAbsoluteUrl($urlJQuery,"jquery");
}
else{
JHtml::_('bootstrap.framework');
}

self::addStyle("jquery-ui.min","jui-smoothness","css/jui/new");

self::addScriptCommon("jquery-ui.min","jquery-ui");

self::addScriptCommon("settings","unite_settings");
self::addScriptCommon("admin","unite_admin");
self::addScriptCommon("jquery.tipsy","tipsy");

//--- add styles
self::addStyleCommon("colors-fresh","wp-colors-fresh");
self::addStyleCommon("buttons","wp-buttons");

self::addStyleCommon("admin","unite_admin");
self::addStyleCommon("admin-joomla","joomla admin additions");

//add tipsy
self::addStyleCommon("tipsy","tipsy");

//include farbtastic
self::addScriptCommon("my-farbtastic","my-farbtastic","js/farbtastic");
self::addStyleCommon("farbtastic","farbtastic","js/farbtastic");

//include codemirror
self::addScriptCommon("codemirror","codemirror_js","js/codemirror");
self::addScriptCommon("css","codemirror_js_css","js/codemirror");
self::addStyleCommon("codemirror","codemirror_css","js/codemirror");

//include fancybox:
self::addScriptCommon("jquery.fancybox-1.3.4.pack","fancybox_js","js/fancybox");
self::addStyleCommon("jquery.fancybox-1.3.4","fancybox_css","js/fancybox");

//include dropdown checklist
//self::addScriptCommon("ui.dropdownchecklist-1.4-min","dropdownchecklist_js","js/dropdownchecklist");
self::addScriptCommon("ui.dropdownchecklist","dropdownchecklist_js","js/dropdownchecklist");
//self::addStyleCommon("ui.dropdownchecklist.standalone","dropdownchecklist_css","js/dropdownchecklist");

}

/**
*
* admin pages parent, includes all the admin files by default
*/
public static function adminPages(){
//self::validateAdminPermissions();
}

/**
*
* validate permission that the user is admin, and can manage options.
*/
protected static function isAdminPermissions(){

if( is_admin() &&  current_user_can("manage_options") )
return(true);

return(false);
}

/**
*
* validate admin permissions, if no pemissions - exit
*/
protected static function validateAdminPermissions(){
if(!self::isAdminPermissions()){
echo "access denied";
return(false);
}
}

/**
*
* set view that will be the master
*/
protected static function setMasterView($masterView){
self::$master_view = $masterView;
}

/**
*
* inlcude some view file
*/
protected static function requireView($view){
try{
//require master view file, and
if(!empty(self::$master_view) && !isset(self::$tempVars["is_masterView"]) ){
$masterViewFilepath = self::$path_views.self::$master_view.".php";
UniteFunctionsRev::validateFilepath($masterViewFilepath,"Master View");

self::$tempVars["is_masterView"] = true;
require $masterViewFilepath;
}
else{ //simple require the view file.
$viewFilepath = self::$path_views.$view.".php";

UniteFunctionsRev::validateFilepath($viewFilepath,"View");
require $viewFilepath;
}

}catch (Exception $e){
echo "<br><br>View ($view) Error: <b>".$e->getMessage()."</b>";

if(self::$debugMode == true)
dmp($e->getTraceAsString());
}
}

/**
* require some template from "templates" folder
*/
protected static function getPathTemplate($templateName){

$pathTemplate = self::$path_templates.$templateName.".php";
UniteFunctionsRev::validateFilepath($pathTemplate,"Template");

return($pathTemplate);
}

/**
*
* require settings file, the filename without .php
*/
public static function requireSettings($settingsFile){

try{
require self::$path_plugin."settings/$settingsFile.php";
}catch (Exception $e){
echo "<br><br>Settings ($settingsFile) Error: <b>".$e->getMessage()."</b>";
dmp($e->getTraceAsString());
}
}

/**
*
* get path to settings file
* @param $settingsFile
*/
protected static function getSettingsFilePath($settingsFile){

$filepath = self::$path_plugin."settings/$settingsFile.php";
return($filepath);
}

/**
*
* add all js and css needed for media upload
*/
protected static function addMediaUploadIncludes(){

self::addWPScript("thickbox");
self::addWPStyle("thickbox");
self::addWPScript("media-upload");

}

/**
* add admin menus from the list.
*/
public static function addAdminMenu(){

$role = "manage_options";

switch(self::$menuRole){
case self::ROLE_AUTHOR:
$role = "edit_published_posts";
break;
case self::ROLE_EDITOR:
$role = "edit_pages";
break;
default:
case self::ROLE_ADMIN:
$role = "manage_options";
break;
}

foreach(self::$arrMenuPages as $menu){
$title = $menu["title"];
$pageFunctionName = $menu["pageFunction"];
add_menu_page( $title, $title, $role, self::$dir_plugin, array(self::$t, $pageFunctionName) );
}

}

/**
*
* add menu page
*/
protected static function addMenuPage($title,$pageFunctionName){

self::$arrMenuPages[] = array("title"=>$title,"pageFunction"=>$pageFunctionName);

}

/**
*
* get url to some view.
*/
public static function getViewUrl($viewName,$urlParams=""){
$params = "&view=".$viewName;
if(!empty($urlParams))
$params .= "&".$urlParams;

$link = self::$url_component. "&page=".self::$dir_plugin.$params;

return($link);
}

/**
*
* register the "onActivate" event
*/
protected function addEvent_onActivate($eventFunc = "onActivate"){
register_activation_hook( self::$mainFile, array(self::$t, $eventFunc) );
}

/**
*
* store settings in the object
*/
protected static function storeSettings($key,$settings){
self::$arrSettings[$key] = $settings;
}

/**
*
* get settings object
*/
protected static function getSettings($key){
if(!isset(self::$arrSettings[$key]))
UniteFunctionsRev::throwError("Settings $key not found");
$settings = self::$arrSettings[$key];
return($settings);
}

/**
*
* add ajax back end callback, on some action to some function.
*/
protected static function addActionAjax($ajaxAction,$eventFunction){
self::addAction('wp_ajax_'.self::$dir_plugin."_".$ajaxAction, $eventFunction);
self::addAction('wp_ajax_nopriv_'.self::$dir_plugin."_".$ajaxAction, $eventFunction);
}

/**
*
* echo json ajax response
*/
private static function ajaxResponse($success,$message,$arrData = null){

$response = array();
$response["success"] = $success;
$response["message"] = $message;

if(!empty($arrData)){

if(gettype($arrData) == "string")
$arrData = array("data"=>$arrData);

$response = array_merge($response,$arrData);
}

$json = json_encode($response);

echo $json;
exit();
}

/**
*
* echo json ajax response, without message, only data
*/
protected static function ajaxResponseData($arrData){
if(gettype($arrData) == "string")
$arrData = array("data"=>$arrData);

self::ajaxResponse(true,"",$arrData);
}

/**
*
* echo json ajax response
*/
protected static function ajaxResponseError($message,$arrData = null){

self::ajaxResponse(false,$message,$arrData,true);
}

/**
* echo ajax success response
*/
protected static function ajaxResponseSuccess($message,$arrData = null){

self::ajaxResponse(true,$message,$arrData,true);

}

/**
* echo ajax success response
*/
protected static function ajaxResponseSuccessRedirect($message,$url){
$arrData = array("is_redirect"=>true,"redirect_url"=>$url);

self::ajaxResponse(true,$message,$arrData,true);
}

/**
*
* Enter description here ...
*/
protected static function updatePlugin($viewBack = false){
$linkBack = self::getViewUrl($viewBack);
$htmlLinkBack = UniteFunctionsRev::getHtmlLink($linkBack, "Go Back");

//check if css table exist, if not, we need to verify that the current captions.css can be parsed
if(UniteFunctionsWPRev::isDBTableExists(GlobalsRevSlider::TABLE_CSS_NAME)){
$captions = RevOperations::getCaptionsCssContentArray();
if($captions === false){
$message = "CSS parse error! Please make sure your captions.css is valid CSS before updating the plugin!";
echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> $message</div><br>";
echo $htmlLinkBack;
exit();
}
}

$zip = new UniteZipRev();

try{

if(function_exists("unzip_file") == false){
if( UniteZipRev::isZipExists() == false)
UniteFunctionsRev::throwError("The ZipArchive php extension not exists, can't extract the update file. Please turn it on in php ini.");
}

dmp("Update in progress...");

$arrFiles = UniteFunctionsRev::getVal($_FILES, "update_file");
if(empty($arrFiles))
UniteFunctionsRev::throwError("Update file don't found.");

$filename = UniteFunctionsRev::getVal($arrFiles, "name");

if(empty($filename))
UniteFunctionsRev::throwError("Update filename not found.");

$fileType = UniteFunctionsRev::getVal($arrFiles, "type");

/*
$fileType = strtolower($fileType);

if($fileType != "application/zip")
UniteFunctionsRev::throwError("The file uploaded is not zip.");
*/

$filepathTemp = UniteFunctionsRev::getVal($arrFiles, "tmp_name");
if(file_exists($filepathTemp) == false)
UniteFunctionsRev::throwError("Can't find the uploaded file.");

//crate temp folder
UniteFunctionsRev::checkCreateDir(self::$path_temp);

//create the update folder
$pathUpdate = self::$path_temp."update_extract/";
UniteFunctionsRev::checkCreateDir($pathUpdate);

//remove all files in the update folder
if(is_dir($pathUpdate)){
$arrNotDeleted = UniteFunctionsRev::deleteDir($pathUpdate,false);
if(!empty($arrNotDeleted)){
$strNotDeleted = print_r($arrNotDeleted,true);
UniteFunctionsRev::throwError("Could not delete those files from the update folder: $strNotDeleted");
}
}

//copy the zip file.
$filepathZip = $pathUpdate.$filename;

$success = move_uploaded_file($filepathTemp, $filepathZip);
if($success == false)
UniteFunctionsRev::throwError("Can't move the uploaded file here: ".$filepathZip.".");

if(function_exists("unzip_file") == true){
WP_Filesystem();
$response = unzip_file($filepathZip, $pathUpdate);
}
else
$zip->extract($filepathZip, $pathUpdate);

//get extracted folder
$arrFolders = UniteFunctionsRev::getFoldersList($pathUpdate);
if(empty($arrFolders))
UniteFunctionsRev::throwError("The update folder is not extracted");

if(count($arrFolders) > 1)
UniteFunctionsRev::throwError("Extracted folders are more then 1. Please check the update file.");

//get product folder
$productFolder = $arrFolders[0];
if(empty($productFolder))
UniteFunctionsRev::throwError("Wrong product folder.");

if($productFolder != self::$dir_plugin)
UniteFunctionsRev::throwError("The update folder don't match the product folder, please check the update file.");

$pathUpdateProduct = $pathUpdate.$productFolder."/";

//check some file in folder to validate it's the real one:
$checkFilepath = $pathUpdateProduct.$productFolder.".php";
if(file_exists($checkFilepath) == false)
UniteFunctionsRev::throwError("Wrong update extracted folder. The file: ".$checkFilepath." not found.");

//copy the plugin without the captions file.
//$pathOriginalPlugin = $pathUpdate."copy/";
$pathOriginalPlugin = self::$path_plugin;

$arrBlackList = array();
$arrBlackList[] = "rs-plugin/css/captions.css";
$arrBlackList[] = "rs-plugin/css/dynamic-captions.css";
$arrBlackList[] = "rs-plugin/css/static-captions.css";

UniteFunctionsRev::copyDir($pathUpdateProduct, $pathOriginalPlugin,"",$arrBlackList);

//delete the update
UniteFunctionsRev::deleteDir($pathUpdate);

dmp("Updated Successfully, redirecting...");
echo "<script>location.href='$linkBack'</script>";

}catch(Exception $e){
$message = $e->getMessage();
$message .= " <br> Please update the plugin manually via the ftp";
echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> $message</div><br>";
echo $htmlLinkBack;
exit();
}

}

   }

  ?>

2018 marked the “End of Life” for PHP 5.6 and 7.0. In the very near future, PHP 7.1 will come to it’s “End of Life”. You may have seen the big red warning on your Joomla administrator panel regarding the upgrade and may have even attempted at upgrading PHP yourself only to have your Joomla site crash (blank page).

Lately we’ve dealt with multiple sites, some of them not even running the latest Joomla, that required specific fixes to have PHP 7.2 running. Although each site is unique when customizations are present, we were able at IDL Web to narrow some of the causes for a failed PHP Upgrade.

1. Up-to-date Extensions

This sounds already like a cliché for CMS and their extensions, but yes, since PHP 5 to 7 presented substantial modifications to some syntax and code properties. Often time developers committed to maintain their extensions keep their code up to date and you will need to grab latest updates of all 3rd party extensions installed on your Joomla website. Keep in mind, not all of your extensions may be using the Joomla Update system. You may not see them on the “update” section of your administrator, and you will have to review/debug which extension can be causing the issue and check if there is any available update.

2. .htaccess File

This PHP upgrade has become a common request from customer to their hosting providers. Even as close to the “End of Life”, some hosting providers didn’t have the option installed to make the switch to a newer PHP version. This resulted in customers moving to other hosting providers or companies refreshing their OS/Compilations. We’ve seen when moving sites and trying to upgrade others that handlers placed in the htaccess file intended to work for previous versions of PHP causes errors when PHP 7.2 is enabled. Since these handlers were placed for previous PHP versions. You will need to check with your hosting provider, but you can try removing any handlers (don’t forget to make a backup), or just placing a fresh Joomla htaccess version to check if it works with PHP 7.2

3. Fatal Error: 0 Using $this when not in object context

This error may have multiple causes, but we found 90% of the time is due to an old way of getting the menu object by templates or extensions.

Search in your template or your old extensions with issues for something like:

JSite::getMenu() or JoomlaCMSApplicationSiteApplication::getMenu()

This calls the getMenu in a static context, which is the incorrect way of calling that method.

The code should be

JFactory::getApplication()->getMenu()

4. Error: [] operator not supported for strings.

Another PHP error with multiple possible sources, but usually found in Joomla templates and extensions assigning values.
Previously, it didn’t throw an error, which it does now on PHP 7.2
Search for any array not declared but set later to [] like:

$css = ”;
and then later used like:
$css[] = ‘ style=”width:’.trim($column_widths[$i]).’px;”‘;

(Very common in old Gantry framework templates)

First line should be changed to

$css = array();

You will need to locate all instances of variables with issues like this and adjust the code.

You may just be getting a blank page or a 500 Internal Server error after your upgrade, don’t forget to enable all error reporting, Joomla debug system and PHP error reporting in your configuration so you can trace back the source of the error and check if any of the causes above may help. Joomla Core is 100% PHP 7.2 compatible. Rest assured the issue is not a core extension and invest your time to look on your 3rd party addons.

If you are not comfortable modifying the code or can’t upgrade any of your Joomla extensions, leave the work to the professional Joomla developers with more than 100+ sites upgraded successfully to PHP 7.2. At IDL Web Inc, we will help you so you have your Joomla website running with the latest and greatest software.

Владельцы сайтов, где установлен компонент Virtuemart, могут столкнуться с проблемами при переходе на версию PHP 7. Определенные страницы, как на фронтальной части, так и в административной панели могут отображаться с ошибкой. В данном материале я решил коллекционировать ошибки и их решения.

Ошибка в административной панели. Раздел «Настройки»

[] operator not supported for strings

Вызвана тем, что к строковой переменной применяется оператор массива.

Для устранения находим файл

/administrator/components/com_virtuemart/models/config.php

Далее в методе getCurrencyConverterList меняем $result = »; на $result = array();

Должно получиться, как на картинке:

Ошибка на фронтальной части сайта при просмотре товара

Cannot access property started with »

Может возникать если у товара есть дочерние товары

Для устранения находим файл:

/administrator/components/com_virtuemart/models/product.php

Далее меняем код:

foreach ($attribs as $k=> $v) {
    if ('product_in_stock' != $k and 'product_ordered' != $k) {// Do not copy parent stock into child
        if (strpos ($k, '_') !== 0 and empty($child->$k)) {
            $child->$k = $v;
            //	vmdebug($child->product_parent_id.' $child->$k',$child->$k);
        }
    }
}

На:

foreach ($attribs as $k=> $v) {
    if (strpos($k, "")===0) continue;
    if ('product_in_stock' != $k and 'product_ordered' != $k) {// Do not copy parent stock into child
        if (isset($parentProduct->$k) && strpos ($k, '_') !== 0 && empty($child->$k)) {
            $child->$k = $v;
            //	vmdebug($child->product_parent_id.' $child->$k',$child->$k);
        }
    }
}

Ошибка с отображением групп пользователей

Не так давно всплыла еще одна ошибка. Собственно говоря, это все следствие того же неправильного указания типа данных. Ошибка с отображением групп пользователей. Группы эти выбираются при доставке, оплате, на странице товара. В общем то, много где.

Изначально у данного списка была возможность мультивыбора. То есть, у одного способа доставки могло быть несколько групп пользователей. Однако, после перехода на PHP 7 эта возможность «отвалилась». Как это исправить?

Находим файл /administrator/components/com_virtuemart/helpers/shopfunctions.php

В этом файле находим метод(функцию) под названим renderShopperGroupList

Далее меняем $attrs = »; на $attrs = array();

Сохраняем файл

Понравилась статья? Поделить с друзьями:
  • Error operator is not overloaded real div real
  • Error operator is not overloaded not ansistring
  • Error operator has no right operand
  • Error operator does not exist text bytea
  • Error operator does not exist interval integer