Post by pm-netti » Sat Sep 03, 2022 5:41 pm

I'm having a strange problem that might be related to PHP 8:

Code: Select all

ParseError: syntax error, unexpected variable "$this", expecting ")" in C:\MAMP\htdocs\4011\extension\plugin\......\plugin.php on line 72
This is line 72:

Code: Select all

$myplugin = new Plugin(string $this->merchant, string $this->secret, array $header, string $body);
This rebukes those attributes. Why?

Ps. This message would have belonged to a different category, but I can't change it ;)

-Peku-

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by pm-netti » Sat Sep 10, 2022 3:21 pm

I don't think anyone has experience with Opencart 4 extensions?
:)

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by thekrotek » Sat Sep 10, 2022 4:18 pm

Try this:

$myplugin = new Plugin((string) $this->merchant, (string) $this->secret, (array) $header, (string) $body);

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by pm-netti » Sat Sep 10, 2022 6:21 pm

thekrotek wrote:
Sat Sep 10, 2022 4:18 pm
Try this:

$myplugin = new Plugin((string) $this->merchant, (string) $this->secret, (array) $header, (string) $body);
Thank you!
Strange that Php 8.1 didn't recognize that code structure at this point.

User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä, Finland

Post by JNeuhoff » Sun Sep 11, 2022 12:08 am

You are dealing here with type-casting which require the brackets. This is different from a function declaration where the argument types are specified without brackets.

As regards OpenCart 4: There is no extension/plugin coming with it, it looks like you are talking about a 3rd party extension.

Anyway, OpenCart 4 isn't yet suitable for live websites, there still too many bugs to be fixed.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 4 guests