Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-12-22 16:28:40

Anton2
New Member
Registered: 2018-12-22
Posts: 9

Cannot use $this as parameter

I’m moving a Textpattern installation to a new server which runs PHP 7.3. I’m using the most recent Textpattern version 4.7.2.

Upon directing my browser to the admin panel, I get the following message:

Fatal error: Cannot use $this as parameter in /var/www/mysite/textpattern/lib/txplib_misc.php(1870) : eval()'d code on line 2

As far as I understand, this is a PHP 7 related issue. Can somebody please suggest a fix for this? Thx in advance.

Offline

#2 2018-12-22 17:20:51

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

Re: Cannot use $this as parameter

Hello, welcome to the forum. It must be some plugin thing, try to disable them globally or one by one.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#3 2018-12-22 17:27:52

Anton2
New Member
Registered: 2018-12-22
Posts: 9

Re: Cannot use $this as parameter

Is there a way of doing that without accessing the admin panel?

Otherwise I’d probably need to move files back and forth between two servers until the problem is hit, would not I?

Offline

#4 2018-12-22 17:40:10

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

Re: Cannot use $this as parameter

Anton2 wrote #315684:

Is there a way of doing that without accessing the admin panel?

Try path/to/site/textpattern/index.php?event=plugin or edit use_plugins pref in txp_prefs table.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#5 2018-12-22 19:24:23

Anton2
New Member
Registered: 2018-12-22
Posts: 9

Re: Cannot use $this as parameter

So I just set the “use_plugins” to 0, but that did not help.

Offline

#6 2018-12-22 19:36:41

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

Re: Cannot use $this as parameter

Then it must be admin_side_plugins, sorry.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#7 2018-12-22 20:29:41

Anton2
New Member
Registered: 2018-12-22
Posts: 9

Re: Cannot use $this as parameter

Thanks, that worked.

Turning “admin_side_plugins” off, I was able to locate the responsible plugin one by one, and then I switched that setting back on.

Offline

#8 2018-12-22 21:32:19

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,103
Website

Re: Cannot use $this as parameter

Hi Anton,

Could you tell us which plugin created the issue?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#9 2018-12-23 12:25:48

Anton2
New Member
Registered: 2018-12-22
Posts: 9

Re: Cannot use $this as parameter

Hi colak,

It was tcm_is_this plugin v0.6c

It runs as follows:

function tcm_is_this($atts, $this)
{
        global $pretext, $thisarticle, $pretext;
        if($pretext['s']==$thisarticle['section']
         &&$pretext['id']==$thisarticle['thisid'])
        {
           return $this;
        }
}

After I changed “function tcm_is_this($atts, $this)” to “function tcm_is_this($atts)” the problem was gone. I am zero in PHP though, and I am not sure if this haven’t broken the plugin. But I completely forgot what this plugin is doing, so I’m afraid I’ll see it only in the course of time, when and if something appears broken in the site.

Last edited by Anton2 (2018-12-23 12:26:36)

Offline

#10 2018-12-23 15:25:04

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,342
Website

Re: Cannot use $this as parameter

I couldn’t find any information on that plugin either. Judging by the code it checks whether the current section matches the section assigned to the current article and the current article id matches the article_id of the article and is probably used to output something – like an “active” or “currently showing” marker – in a loop when the item in a list matches the currently showing article (in its own section).

BTW: It only needs referencing $pretext once, so global $pretext, $thisarticle; will suffice.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB