Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-11-25 02:50:08

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,208
Website

PHP 8.4 “Undefined variable $groupby ” warning with txp:images

(because Homebrew was nagging I updated the local server)

PHP8.4.1, TXP 4.9-dev uptodate, debug mode.

Warning: Undefined variable $groupby Issue detected while parsing form None on page playground

Input (in the <head />):

<if::article_image>
<txp:images>
    <meta property="og:image" content="<image::url escape="html" />" />
    <meta property="og:image:width" content="<image::info type="w" />" />
    <meta property="og:image:height" content="<image::info type="h" />" />
    <meta property="og:image:alt" content="<image::info type="alt" />" />
</txp:images>
</if::article_image>

I also insert images in the body of the article with <txp:images /> which triggers the warning but that is nested in complex shortcode. The little block above is easier to parse.

On the admin side everything seems to hold fine with PHP 8.4, so far.

–^–

Edit

Noticed now, that test page is supposed to load two more images that are completely missing. With older PHP I thought I had a least a warning that the requested by the txp:shortcode was missing. The shortcode: <txp::pw_imageL id="30,25" />; the image with ID-30 is missing from the system.

This needs further testing

Last edited by phiw13 (2024-11-25 03:06:18)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#2 2024-11-25 04:30:07

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,208
Website

Re: PHP 8.4 “Undefined variable $groupby ” warning with txp:images

After reviewing and testing some more, this not really new nor any sort of “bug”. This can be reproduced with PHP 8.3. Every case that throws an error is because the requested image ID is missing from the DB and the associated image is not on the file system (anymore).

It is, in this case a very poorly formulated description for the issue at hand.

I don’t know if that can be improved from the Textpattern side or if that is a PHP issue.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2024-11-25 06:57:55

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: PHP 8.4 “Undefined variable $groupby ” warning with txp:images

A search for “Undefined variable $groupby” reveals some interesting results of mostly WP sites totally crashing.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2024-11-25 07:55:44

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

Re: PHP 8.4 “Undefined variable $groupby ” warning with txp:images

We should guard against empty image results so this smells like a bug to me.


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

#5 2024-11-25 08:27:47

etc
Developer
Registered: 2010-11-11
Posts: 5,210
Website GitHub

Re: PHP 8.4 “Undefined variable $groupby ” warning with txp:images

Could you post more diagnostics (line numbers) please? Can not reproduce on my side.

Offline

#6 2024-11-25 08:38:27

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,208
Website

Re: PHP 8.4 “Undefined variable $groupby ” warning with txp:images

Here you go, sorry for forgetting that. This is for the sample given in the OP.

textpattern/vendors/Textpattern/Tag/Syntax/Image.php:389 parseList()
Textpattern\Tag\Syntax\Image::images()
textpattern/vendors/Textpattern/Tag/Registry.php:138 call_user_func()
textpattern/lib/txplib_publish.php:534 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:423 processTags()
textpattern/publish/taghandlers.php:1911 parse()
if_article_image()
textpattern/vendors/Textpattern/Tag/Registry.php:138 call_user_func()
textpattern/lib/txplib_publish.php:534 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:423 processTags()

If that matters, article status is “Live”, not much special at all in the meta-data fields


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#7 2024-11-25 09:14:09

etc
Developer
Registered: 2010-11-11
Posts: 5,210
Website GitHub

Re: PHP 8.4 “Undefined variable $groupby ” warning with txp:images

Thanks, should be fixed now, sorry for the trouble.

Offline

#8 2024-11-25 09:20:33

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,208
Website

Re: PHP 8.4 “Undefined variable $groupby ” warning with txp:images

etc wrote #338340:

Thanks, should be fixed now, sorry for the trouble.

Yes! No more warning all over.

Thank you.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB