Support is online

Import problem on Virtuemart (ROCSVI 7.15 version) - Error Field Combine #62379

Resolved trackidea opened this topic Tuesday, 14 April 2020 · 5 replies
Author

Hi,

I have encountered a bug in the New version of ROCSVI 7.15. - Virtuemart Plugin
I do not use import rules in my template.

In particular, only from CRON script, when I try to import a list of articles I get the following error:

Parse error: syntax error, unexpected '?' in /plugins/csvirules/fieldcombine/fieldcombine.php on line 173

This error does not occur if the file is imported from the backend!

Comparing the "fieldcombine.php" file of version 7.15 with the file of version 7.14, there is an excess code, in line 173 which releases the error!

This is the excess code:
$defaultValue = $fieldDefaultValue->default_value ?? '';

I proceeded to remove the excess code (?? '') and the new code is:
$defaultValue = $fieldDefaultValue->default_value;

After this modification the problem is solved!

can you verify why this happens?
Why did this bug occur in the new version?

This Workaround is correct?

I hope it will be useful to users

Thanks

Support

Hello,

This is actually not excess code but this is called the null-coalescing operator introduced in PHP 7.0 (isset_ternary). Which PHP version are you running?

You can also use the following code which means the same:

$defaultValue = isset($fieldDefaultValue->default_value) ? $fieldDefaultValue->default_value : '';

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi,

I use the PHP 7.3.16

I have try your alternative code and this work fine.

Many thanks.

Support

Hello,

I think that your PHP CLI version is still PHP 5.6 and your PHP web version is PHP 7.3. That is why you see the error on running the cronjob.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

This fix worked for me, php 5.6 - I can now import to Virtuemart without the error :)

//$defaultValue = $fieldDefaultValue->default_value ?? '';
$defaultValue = isset($fieldDefaultValue->default_value) ? $fieldDefaultValue->default_value : '';

Support

Hello,

This fix worked for me, php 5.6 - I can now import to Virtuemart without the error :)

Glad to know that the fix worked for you.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Log in to reply to this topic.