Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-11-03 11:43:43

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,273
Website

Fatal error: Cannot use $this as parameter

I’m getting the following error:

Fatal error: Cannot use $this as parameter in /home/grampia1/public_html/textpattern/lib/txplib_misc.php(1870) : eval()'d code on line 716

I’m trying to transfer a website from Mac to Live hosting.

I can set up a vanilla TXP website on the live hosting but when I copy across the local files & database dump file, restore it using phpMyAdmin, then refresh TXP admin the above error is generated.

Any thoughts?

Offline

#2 2020-11-03 11:58:34

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,350
Website

Re: Fatal error: Cannot use $this as parameter

Would it be caused by a plugin? Is the error still present when all plugins are off?


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#3 2020-11-03 12:06:13

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,273
Website

Re: Fatal error: Cannot use $this as parameter

Hi Yiannis, thanks for the reply.

It looks like it’s a PHP version issue. Changed the online version to match my local version and … phew!

Offline

#4 2020-11-03 12:09:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,350
Website

Re: Fatal error: Cannot use $this as parameter

👍


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#5 2020-11-03 12:11:45

etc
Developer
Registered: 2010-11-11
Posts: 3,989
Website

Re: Fatal error: Cannot use $this as parameter

Hi both,

this looks like coming from eval(), but in 4.8 we only use it in <txp:php /> tag, please check if you have any. Before 4.8 we eval’d plugins code too, so Yiannis could be right.

Edit: for the record.

Offline

#6 2020-11-04 05:55:30

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,273
Website

Re: Fatal error: Cannot use $this as parameter

Thanks guys. Have found a couple of plugins that use $this as a variable but there’s nothing obvious as to why it would be a problem in PHP 7.2.34 but not in 5.6.40.

Cheers,

Adi

Offline

#7 2020-11-04 07:13:15

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,350
Website

Re: Fatal error: Cannot use $this as parameter

It is indeed strange as I am using plugins using $this on PHP version 7.4.10 without any issues.

  • rah_external_output 1.0.4 (I know it is no longer needed but I am too lazy to find all instances in other sites)
  • ied_plugin_composer 1.2.1
  • oui_cookie 1.0.0-Beta4
  • com_connect 4.7
  • rss_admin_db_manager 4.6

Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#8 2020-11-04 08:18:53

etc
Developer
Registered: 2010-11-11
Posts: 3,989
Website

Re: Fatal error: Cannot use $this as parameter

gomedia wrote #326668:

Have found a couple of plugins that use $this as a variable but there’s nothing obvious as to why it would be a problem in PHP 7.2.34 but not in 5.6.40.

Seemingly the switch has been operated in php 7.1.

colak wrote #326669:

It is indeed strange as I am using plugins using $this on PHP version 7.4.10 without any issues.

$this is not deprecated, only its behavior in certain constructions is.

Offline

#9 2020-11-04 08:36:51

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,273
Website

Re: Fatal error: Cannot use $this as parameter

One learns something new every day! Thanks Oleg.

Offline

Board footer

Powered by FluxBB