janboddez / indieblocks

Use blocks, and, optionally, "short-form" post types to more easily "IndieWebify" your WordPress site.
https://indieblocks.xyz
GNU General Public License v3.0
22 stars 3 forks source link

Note Publish 500 error #167

Closed mediaformat closed 6 months ago

mediaformat commented 7 months ago

This seems similar to https://github.com/janboddez/indieblocks/issues/160, but I'm running 0.12.0

I first noticed this trying to reply from the feed-reader, but it happens from the post page as well.

When I attempt to Publish I get an ajax 500 error which leaves the editor in an unpublished state, however the post does publish, and federate. I just need to refresh the whole page, same happens when trying to delete a Note.

Sorry I don't have any useful logs right now. Here is a partial list of plugins:

janboddez commented 6 months ago

If you enabled WordPress' error logging, you should find the root cause in WordPress' (or your PHP's) debug log.

The other issue occurred during sending of a webmention, and only if the remote sender returned a server error.

This here issue is something that happens during (or rather, after) publish, so it could be any of the plugins that hook into any of the actions that run on save.

Since the editor expects a JSON response but WordPress returns an (HTML) error page, it seemingly gets "stuck" in the state you mention.

mediaformat commented 6 months ago

Ok, I managed to get the error:

Call to undefined function IndieBlocks\Mf2parse() in .../includes/class-parser.php:111

janboddez commented 6 months ago

Oh, that's strange. There should be a backslash: IndieBlocks\Mf2\parse().

It should be called as Mf2\parse() here: https://plugins.trac.wordpress.org/browser/indieblocks/tags/0.12.0/includes/class-parser.php#L111.

And it should be defined here: https://plugins.trac.wordpress.org/browser/indieblocks/tags/0.12.0/build/vendor/mf2/mf2/Mf2/Parser.php#L44

Do you have that build/vendor file? Does it have the IndieBlocks\Mf2 namespace?

mediaformat commented 6 months ago

My bad, I mis-transcribed, it is indeed called as IndieBlocks\Mf2\parse().

Both files, and selected lines are there too.

janboddez commented 6 months ago

Looks like the autoloader not doing its thing ... Since everything is prefixed, I would not have expected issues there.

Have you ever played around with Composer, on your WordPress install?

I'm guessing deleting and re-installing the plugin don't work? Because that should solve it (unless there's a conflict somewhere).

What OS and PHP version are you on? (Although I'd expect errors if there was an issue there.)

janboddez commented 6 months ago

Actually, I had the same issue before, and it must've been me messing up because when I reinstalled ("from scratch") the issue was gone ...

mediaformat commented 6 months ago

No composer use on the server, I've also tried deleting and reinstalling both IndieBlocks and Feed Reader, getting the same error still.

Debian 11, PHP 8.2

janboddez commented 6 months ago

Feed Reader uses the same parser class, and Webmention may very well, too. But at least IndieBlocks and Feed Reader use (different) namespace prefixes, so there should not be a conflict ...

Have you ever tried it with all other (than IndieBlocks) plugins disabled?

janboddez commented 6 months ago

Oh, wait, I'm only now reading through the other issue. Looks like there may be a conflict, still. (Even if I use both plugins together without issue, but I may also be using a later version.)

So, the issue I had before, was caused by https://github.com/humbug/php-scoper/issues/298

Could be I just need to update the plugin, either one of them, or both, in the repo.

Fun fact: if I hadn't used a prefixer/scoper, there would probably not be an issue ...

Different question: have you tried installing/replacing Feed Reader and IndieBlocks with the version(s) here on GitHub?

janboddez commented 6 months ago

Right, I think the issue is that Feed Reader's autoloader actually dates from before I fixed it (even if the commit dates seem to suggest otherwise).

The GitHub version should work.

I'll update the WP version soon.

janboddez commented 6 months ago

I'm 95% sure the PHP-Scoper bug is what caused this conflict, so I pushed a long overdue update of Feed Reader to the WP.org repo.

I myself am currently running this alongside the WP.org version of IndieBlocks just fine. Hope this solves it for you, too?

mediaformat commented 6 months ago

Thanks @janboddez that update seems to have cleared things up!!

janboddez commented 5 months ago

Believe it or not, I'm experimenting with a plugin that similarly uses PHP-Scoper and I'm running into this exact problem again.

janboddez commented 5 months ago

OK, I think it may have been because I used A\Certain\Namespace rather than, well, one word.