Parse error: syntax error, unexpected ':', expecting ';' or '{' in /vendor/oxid-esales/oxideshop-ce/source/Core/Email.php on line 2307

I am using the core email functionality and it is showing me syntax error in vendor file

My piece of code:

if ($oModel->isTrackingNrResponse()) {
           echo "Sending Tracking E-Mail \n";
           $oEmail = oxNew(Email::class);
           $oEmail->sendSendedNowMail($oOrder);
     }

The error i get:

Parse error: syntax error, unexpected ‘:’, expecting ‘;’ or ‘{’ in /vendor/oxid-esales/oxideshop-ce/source/Core/Email.php on line 2307

And this is the function:

 private function shouldProductReviewLinksBeIncluded(): bool
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();

        $reviewsEnabled = $config->getConfigParam('bl_perfLoadReviews', false);
        $productReviewLinkInclusionEnabled = $config->getConfigParam('includeProductReviewLinksInEmail', false);

        return  $reviewsEnabled && $productReviewLinkInclusionEnabled;
    }

I am using
PHP version 7.0.33
OXID CE version 6.1.4

Why is there a syntax error in core file? Any leads? This is breaking my cronjob loop

Maybe not in CLI when calling your cronjob? You could try a “php -v” in a console window.

Is this a problem ?

I changed the cronjob php version to 7 and now its working. Thankyou very much for the insight! :slightly_smiling_face:

Yes, of course.

function foo(): bool
{
    return true;
}

Type Hinting with :bool need PHP Version 7.x more infos Online PHP editor | output for tubAB

1 Like

The problem was cronjob was using PHP version 5.6 and that’s why there was a syntax error issue, Because in 5.6 there is no syntax like that :slightly_smiling_face:

function foo(): bool
    {
        return true;
    }
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.