cancel
Showing results for 
Search instead for 
Did you mean: 

Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

hello, im trying to upgrade Magento Version 2.3.4 to Magento 2.4.0,

all are done without error,

 

but at last i have update composer and then run bin/magento cache:clean command i get error like this,

Constant name is expected.

then searched for this, and i found in vendor/magento/framework/Data/Argument/Interpreter/Constant.php

file i add print_r($data);exit; and run command,

i get below output 

Array
(
[name] => code
[value] => Magento\Braintree\Model\Ui\ConfigProvider::CODE
)

and that is found in vendor/paypal/module-braintree-core/Model/Ui/ConfigProvider.php

 

in this file has already code of const CODE = 'braintree';

now exactly where is the issue i don't found, please help me on this.

Thanks.

12 REPLIES 12

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

Hi @R K Solanki ,

 

Can you check the same constant in file

vendor/magento/module-braintree/Model/Ui/ConfigProvider.php

 

If this file exist because according to error they expect this constant should be in above file. If file exist, try to add the constant code and check if your issue resolves.

 

Hope this helps you!

Problem Solved! Click Kudos & Accept as Solution!

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

Hello @Nishu Jindal ,

thanks for the answer,

i have already checked in 

vendor/magento/module-braintree/Model/Ui/ConfigProvider.php file,

this file exists and also the CONST code also exists,

and i get error,

 

class ConfigProvider implements ConfigProviderInterface
{
const CODE = 'braintree';

const CC_VAULT_CODE = 'braintree_cc_vault';

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

Hi @R K Solanki ,

 

I found below description related to your error.

Can you check once.

 

I think some problem in your etc folder. check all xml files. Constant name should be in CAPITAL letters. any of your constant remain in small letters. check it and correct it. Hope this will solve your Problem.

 

Hope this helps you!

Problem Solved! Click Kudos & Accept as Solution!

 

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

@Nishu Jindal i have checked in app/etc folder, there are few xml files,

db_schema.xml, di.xml files,

i have checked using grep command, but not found Constant name in Capital or small letters

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

For upgrade Magento i have run this all commands

 

php73 -dmemory_limit=8G bin/magento maintenance:enable
/usr/bin/php73 -dmemory_limit=4G /usr/local/bin/composer require magento/composer-root-update-plugin=~1.0 --no-update
/usr/bin/php73 -dmemory_limit=4G /usr/local/bin/composer update
cp composer.json composer.json.bak
/usr/bin/php73 -dmemory_limit=4G /usr/local/bin/composer remove magento/product-community-edition --no-update
/usr/bin/php73 -dmemory_limit=4G /usr/local/bin/composer require magento/product-community-edition=2.4.0 --no-update
/usr/bin/php73 -dmemory_limit=4G /usr/local/bin/composer update
php73 -dmemory_limit=8G bin/magento cache:clean

 

at last i run this coomand php73 -dmemory_limit=8G bin/magento cache:clean and i get this error,
i checked in app/code but this braintree module not in this folder, checked etc folder all xml file, but not this Constant write in this files,

 

now where to look in magento directory?

please help me

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

Hi @R K Solanki ,

 

Can you run below command and check if you get same error

php73 -dmemory_limit=8G bin/magento setup:upgrade

 

Also cross check if your any of custom module have any customization done on braintree module.if yes, try to comment the customization and check your error.

 

Hope this helps you!

Problem Solved! Click Kudos & Accept as Solution!

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

Hello,
I am also having the exact same issue. I checked all XML files but can't find any issue. Also no Braintree module folder on the app/code folder. The issue actually comes after running the following command and it showing the same error after Magento update to 2.4.0:

composer require magento/composer-root-update-plugin=~1.0 --no-update
composer update

Please help me to solve the issue

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

The same thing happened to me as well, cinema hd but i woudn't want to type all that here. Just looking for the way to get out of it smoothly.

Re: Constant name is expected after upgrade magento 2.3.4 to magento 2.4.0

I also have same issue are you found any solution for that?