Future error "Use of undefined constant" and ARRAY

31.08.2020 18:45
#1
vitaly2016
Joomshopping forum user no avatar
Name: Vitaly
14.06.2016
Posts: 18
Quote
Future error "Use of undefined constant" and ARRAY

After Update PHP I have errors in system log. This happens in backend, Products page:

PHP Warning: Use of undefined constant _JSHOP_MENU_CATEGORIES - assumed '_JSHOP_MENU_CATEGORIES' (this will throw an Error in a future version of PHP) in /administrator/components/com_jshopping/functions.php on line 113
(similar errors are from line 113 to 120)

Here is code that causes errors:
================
function addSubmenu($vName){
$user = JFactory::getUser();
$dispatcher = JDispatcher::getInstance();
$adminaccess = $user->authorise('core.admin', 'com_jshopping');
$installaccess = $user->authorise('core.admin.install', 'com_jshopping');

$menu = array();
$menu['categories'] = array(_JSHOP_MENU_CATEGORIES, 'index.php?option=com_jshopping&controller=categories&catid=0', $vName == 'categories', 1);
$menu['products'] = array(_JSHOP_MENU_PRODUCTS, 'index.php?option=com_jshopping&controller=products&category_id=0', $vName == 'products', 1);
$menu['orders'] = array( _JSHOP_MENU_ORDERS, 'index.php?option=com_jshopping&controller=orders', $vName == 'orders', 1);
$menu['users'] = array(_JSHOP_MENU_CLIENTS, 'index.php?option=com_jshopping&controller=users', $vName == 'users', 1);
$menu['other'] = array(_JSHOP_MENU_OTHER, 'index.php?option=com_jshopping&controller=other', $vName == 'other', 1);
$menu['config'] = array( _JSHOP_MENU_CONFIG, 'index.php?option=com_jshopping&controller=config', $vName == 'config', $adminaccess );
$menu['update'] = array(_JSHOP_PANEL_UPDATE, 'index.php?option=com_jshopping&controller=update', $vName == 'update', $installaccess );
$menu['info'] = array(_JSHOP_MENU_INFO, 'index.php?option=com_jshopping&controller=info', $vName == 'info', 1);

$dispatcher->trigger('onBeforeAdminMenuDisplay', array(&$menu, &$vName));

foreach($menu as $item){
if ($item[3]){
JHtmlSidebar::addEntry( $item[0], $item[1], $item[2]);
}
}
}
===============================
Similar error was in some plugin language files, but it was solved simply by quoting constant.
For example
define(_JSHOP_WAYFORPAY_SECRET_KEY, 'Secret key'); - problem line
define('_JSHOP_WAYFORPAY_SECRET_KEY', 'Secret key'); - solved line

But I don't understand how solve problem in array.

How should I change line like this:
$menu['categories'] = array(_JSHOP_MENU_CATEGORIES, 'index.php?option=com_jshopping&controller=categories&catid=0', $vName == 'categories', 1);
to solve problem?
If I just quote _JSHOP_MENU_CATEGORIES to '_JSHOP_MENU_CATEGORIES' errors stop but text in left side menu is not correct - I see text _JSHOP_MENU_CATEGORIES.


Last change: 01.09.2020 13:05
 
31.08.2020 22:01
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21565
Quote
Aw: Future error "Use of undefined constant" and ARRAY

Joomshopping version?

 
01.09.2020 12:59
#3
vitaly2016
Joomshopping forum user no avatar
Name: Vitaly
14.06.2016
Posts: 18
Quote
Aw: Future error "Use of undefined constant" and ARRAY

Latest, 4.18.4
I checked installation package from this site:
file \admin\functions.php is dated 2016 and it's header as follows:
* @version 4.10.0 31.05.2014


Last change: 01.09.2020 13:03
 
01.09.2020 15:12
#4
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21565
Quote
Aw: Future error "Use of undefined constant" and ARRAY

Your language?

define(_JSHOP_WAYFORPAY_SECRET_KEY, 'Secret key'); - no code in Joomshopping

 
01.09.2020 16:50
#5
vitaly2016
Joomshopping forum user no avatar
Name: Vitaly
14.06.2016
Posts: 18
Quote
Aw: Future error "Use of undefined constant" and ARRAY

define(_JSHOP_WAYFORPAY_SECRET_KEY, 'Secret key');
This language string from Joomshopping PLUGIN
And as I noted there is no problem to add quotes for simple language strings like "define(...."

I ask help for ARRAY and this is in CORE joomshopping file \
/administrator/components/com_jshopping/functions.php


Last change: 01.09.2020 16:54
 
01.09.2020 20:02
#6
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21565
Quote
Aw: Future error "Use of undefined constant" and ARRAY

language?

not bug for en-GB, de-DE

Your lang file?

 
02.09.2020 11:50
#7
vitaly2016
Joomshopping forum user no avatar
Name: Vitaly
14.06.2016
Posts: 18
Quote
Aw: Future error "Use of undefined constant" and ARRAY

Language is ru_RU (admin panel)
I checked /administrator/components/com_jshopping/lang/ru-RU.php and it seems has no problem
ru-ru.zip

 
03.09.2020 07:23
#8
vitaly2016
Joomshopping forum user no avatar
Name: Vitaly
14.06.2016
Posts: 18
Quote
Aw: Future error "Use of undefined constant" and ARRAY

It's strange, but suddenly there are no errors in log. Sorry for disturbing

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.