qenta-cee / woocommerce-qcs

Accept Credit Cards, PayPal and many other payment methods in your WooCommerce store
https://www.qenta.com
GNU General Public License v2.0
2 stars 1 forks source link

Plugin can not be activated due fatal error #88

Closed roms981 closed 2 years ago

roms981 commented 2 years ago

Prerequisites

Versions

WooCommerce version: 5.9 PHP version: 7.2

Issue

Problem description:

Plugin can not be activated due an fatal error

Parse error: syntax error, unexpected end of file in /vhosts/.../html/wp-content/plugins/qenta-checkout-seamless-old/woocommerce-qenta-checkout-seamless.php on line 242

FIX:

Line 242 where the string end of string JSCODE is defined, must not be indented

function add_qenta_storage_check()
{
    // this is to be added to the footer, see wp_register_script arguments
    wp_register_script('qentaStorageCheckJS', '', [], '', true);
    $jsQentaStorageCheck = <<<JSCODE
  if ( 'undefined' != typeof QentaCEE_DataStorage ) {
    const originalMethod = QentaCEE_DataStorage.prototype.storePaymentInformation;
    QentaCEE_DataStorage.prototype.storePaymentInformation = function( paymentInformation, callback ) {
        if ( 'undefined' != typeof this.iframes && this.iframes.CCARD && ! this.iframes.CCARD.contentWindow ) {
            this.iframes.CCARD = document.querySelector('iframe');
        }

        return originalMethod.apply( this, arguments );
    }
  }
JSCODE;     /// <<< 

see https://www.php.net/manual/de/language.types.string.php#language.types.string.syntax.heredoc

The closing identifier may be indented by space or tab, in which case the indentation will be stripped from all lines in the doc string. Prior to PHP 7.3.0, the closing identifier must begin in the first column of the line.

Steps to reproduce:

HMKnapp commented 2 years ago

Thank you for this detailed description. Although PHP version 7.2 is not supported we added the proposed fix to the latest maintenance release available on the Releases Page.