1. trackidea
  2. RO CSVI
  3. Tuesday, 14 April 2020
  4.  Subscribe via email
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
Accepted Answer
Accepted Answer Pending Moderation
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
  1. more than a month ago
  2. RO CSVI
  3. # Permalink
Accepted Answer Pending Moderation
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
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Hi,

I use the PHP 7.3.16

I have try your alternative code and this work fine.

Many thanks.
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
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 : '';
  1. more than a month ago
  2. RO CSVI
  3. # 3
Accepted Answer Pending Moderation
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
  1. more than a month ago
  2. RO CSVI
  3. # 4
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!