Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2021-04-16 07:11:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: Fatal error

gavnosis wrote #329859:

Why (O-Y-O-Y) would installed plugins not be listed within Textpattern itself

Therein lies the conundrum. Short of it being a filesystem issue – unlikely since Diagnostics says all files are present and correct – or a table-specific connectivity issue, I’m floundering here to understand why this is happening.

Random thoughts:

  1. Put your site into debugging mode and visit the Plugins panel. See if any errors are kicked out. You can flick it back to Live immediately after.
  2. Check your table collations on the txp_plugin table match the other tables. Maybe some of the rows/columns have the wrong collation and Txp is having a hard time interpreting the data.
  3. Check your table indexes are intact and are indexing data. There should be two:
UNIQUE name            (name),
INDEX  status_type_idx (status, type)

Past that, I’m struggling, sorry.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#26 2021-04-16 07:29:07

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: Fatal error

Thank you for the suggestion. And, oh, this doesn’t look good in plugins in debugging mode

User_Error "Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_german2_ci,IMPLICIT) for operation 'strcmp'"

in… /textpattern/lib/txplib_db.php at line 453.

And there’s more, too :-(

adminErrorHandler()
textpattern/lib/txplib_db.php:453 trigger_error()
textpattern/lib/txplib_db.php:1191 safe_query()
textpattern/lib/txplib_db.php:1039 startRows()
textpattern/include/txp_plugin.php:190 safe_rows_start()
textpattern/include/txp_plugin.php:56 plugin_list()
textpattern/index.php:228 include()
Warning "mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, bool given"

Offline

#27 2021-04-16 08:02:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: Fatal error

Okay, result! That’s all fixable and explains it.

I’ve seen this on other tables where stuff just doesn’t appear in the admin side because the database can’t resolve the collation conflicts. That second error is a byproduct of the first so it’ll go away when the collations are fixed.

I’d suggest inspecting the collations used on other tables. Find a table that renders fine (without errors in debugging mode) on the admin side – pages, forms, textpattern, link, images, whatever – and take a look at the collation it uses for columns. Then go to your txp_plugin table and alter the collation on any columns that don’t match. I suspect that any with latin1_german2_ci will need to become utf8_general_ci, but it could be the other way around depending on where your database is located and its language and so forth.

Once you’ve altered those, the Plugins panel should load fine. You can verify it with a quick trip to debugging mode and if there are any stragglers, they’ll show up.

Quite how this situation occurs, btw, is not something that’s apparent to me. It just does. If anybody knows why or how this happens (perhaps content itself is encoded in a particular collation and Txp doesn’t correct it, taking it verbatim?) then I’d love to find out what causes it.

Last edited by Bloke (2021-04-16 08:04:06)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#28 2021-04-16 08:46:44

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: Fatal error

Thank you Stef

Pretty much everything has collations of latin1_german2_ci, including txp_plugin

txp_page 		latin1_german2_ci
txp_image		latin1_german2_ci

In fact the only there tables which don’t are these

txp_skin 	utf8_general_ci
txp_token 	utf8_general_ci
smd_tags 	utf8_general_ci

Would I change these three to latin1_german2_ci?

Offline

#29 2021-04-16 09:14:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: Fatal error

If latin1_german2_ci is the dominant collation then, sure, use that. Whichever is least work :)

Check for column collations as well as table collations. Each column in each table has its own collation and they should all match for a seamless ride.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#30 2021-04-16 09:18:25

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,277
GitHub

Re: Fatal error

Bloke wrote #329865:

I’ve seen this on other tables where stuff just doesn’t appear in the admin side because the database can’t resolve the collation conflicts. That second error is a byproduct of the first so it’ll go away when the collations are fixed.

[…]

Quite how this situation occurs, btw, is not something that’s apparent to me. It just does. If anybody knows why or how this happens (perhaps content itself is encoded in a particular collation and Txp doesn’t correct it, taking it verbatim?) then I’d love to find out what causes it.

Same here. It’s baffled me a few times, especially with oooold sites where hosting organisation has changed more than once. Some European hosters (and MediaTemple back in the day, inexplicably) set the MySQL collation to their (European) datacenter location, which causes snags when you move to another host that doesn’t necessarily support that collation.

Last edited by gaekwad (2021-04-16 09:35:08)

Offline

#31 2021-04-16 14:50:26

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: Fatal error

Well, firstly a big thank you for helping me fix a thing which I didn’t know was broken ;-)
I have changed the tables collations and tables columns collations to utf8_general_ci

This has allowed me to see all the plugins installed again (hooray), although I’m not sure I could enter Mastermind on undertanding the differences between unicode characters types (I’m hoping this collation isn’t some terrible faux pas which will have you rolling your eyes in despair…)

I have then changed the line in Claire’s cbe_frontauth plugin as suggested

include_once(txpath.'/include/txp_admin.php');

And this unfortunately takes me back to my original error message

Fatal error: Uncaught Error: Call to undefined function txp_validate()

As an alternative, is there another better way to have a password protected area of the website, which will display one thing if a user is logged in and something else if they’re not?

Offline

#32 2021-04-16 15:59:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: Fatal error

gavnosis wrote #329879:

I’m hoping this collation isn’t some terrible faux pas

Glad you got it sorted. Collations are a law unto themselves so you’re not alone being a little in the dark. I’m sure somebody out there understands them, but that person ain’t me!

this unfortunately takes me back to my original error message

Drat. I’ll have to look more closely at the code.

As an alternative, is there another better way to have a password protected area of the website, which will display one thing if a user is logged in and something else if they’re not?

If you don’t mind letting people log in via the back-end then how about <txp:if_logged_in>?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#33 2021-04-16 16:49:17

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: Fatal error

If you don’t mind letting people log in via the back-end then how about <txp:if_logged_in>?

And just do something funny with one of the (your!) plugins to restrict everything?

I just quite liked there being a nice box on the page which said login …and then was pleased with myself to show a sticky article if not logged in and the other articles in the section if they were

I almost needed a lie down after thinking up something so fiendishly clever (Like Pooh bear, with only a small brain)

Last edited by gavnosis (2021-04-16 16:49:57)

Offline

#34 2021-04-16 17:15:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: Fatal error

gavnosis wrote #329882:

And just do something funny with one of the (your!) plugins to restrict everything?

Sure, or rah_privileges. If you want to be even cleverer, I’ve done this in the past:

Front-end

<a href="/textpattern">Login</a>
<txp:if_logged_in>
Show sticky content
</txp:if_logged_in>

Back-end

  1. Set all your semi-untrusted front-end editors to the same group (e.g. Staff Writer).
  2. Use rah_privileges to turn off everything of interest for StaffWriter. Just in case.
  3. Write a five-line plugin that detects if the user is a StaffWriter on a page with /textpattern in it. If so, redirect them to the front-end instead. Bonus points for redirecting them to the page they came from if you can somehow get the referer header from the page where they clicked Login.

:)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#35 2021-04-19 09:02:11

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: Fatal error

Thank you Stef,

I think you might have mixed me up with a super hero, and I was with you until stage 3 ;-)
Me? Write a plugin?? Well, I’ll dust off my ‘PHP Programming for Beginners’ book. What’s the worst that could happen?

Offline

#36 2021-04-19 09:16:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: Fatal error

gavnosis wrote #329897:

I think you might have mixed me up with a super hero, and I was with you until stage 3 ;-)

Haha, well if you get stuck and would like a hand with it, just let me know. I have a bunch of tiny little helper plugins dotted around that do various things like this, so it should be a cinch to cobble those together into one to suit your requirements. Just let me know how far you get and which role you’ve chosen as your no access to the admin side group and how opinionated you want to be with redirecting (and where they should end up, etc).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB