Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2021-12-09 09:34:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,472
Website GitHub

Re: php 8.1

Plugin patched to support AVIF but as I don’t have PHP 8.1 yet it’s untested. Reports welcome.


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#17 2021-12-09 10:27:04

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

Re: php 8.1

It looks like PHP getimagesize() function (used for thumbnail creation) is not able to detect the dimensions of AVIF files. Patching as I can, but it looks tough…

Offline

#18 2021-12-09 10:45:43

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

Re: php 8.1

etc wrote #332149:

It looks like PHP getimagesize() function (used for thumbnail creation) is not able to detect the dimensions of AVIF files. Patching as I can, but it looks tough…

Devil’s advocate: do we want to pull this from 4.8.8 and defer to 4.8.9?

Offline

#19 2021-12-09 11:26:31

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

Re: php 8.1

Issue with thumbnail creation – both using the TXP-core function and the smd_thumbnail plugin

First without the plugin:

Warning "imagecreatefromavif(): AVIF image support has been disabled
"
in /Users/username/Sites/phiw13-local/textpattern/lib/class.thumb.php at line 308.

adminErrorHandler()
textpattern/lib/class.thumb.php:308 imagecreatefromavif()
textpattern/lib/class.thumb.php:546 wet_thumb->write()
textpattern/include/txp_image.php:1123 txp_thumb->write()
textpattern/include/txp_image.php:64 thumbnail_create()
textpattern/index.php:230 include()

and

Warning "imagecreatefromavif(): "/Users/username/Sites/phiw13-local/images/45.avif" is not a valid AVIF file"
in /Users/username/Sites/phiw13-local/textpattern/lib/class.thumb.php at line 308.

adminErrorHandler()
textpattern/lib/class.thumb.php:308 imagecreatefromavif()
textpattern/lib/class.thumb.php:546 wet_thumb->write()
textpattern/include/txp_image.php:1123 txp_thumb->write()
textpattern/include/txp_image.php:64 thumbnail_create()
textpattern/index.php:230 include()

and then (formatted like this):

Fatal error: Uncaught DivisionByZeroError: Division by zero in /Users/username/Sites/phiw13-local/textpattern/lib/class.thumb.php:334 Stack trace: #0 /Users/username/Sites/phiw13-local/textpattern/lib/class.thumb.php(546): wet_thumb->write('/Users/username/S...', '/Users/username/S...') #1 /Users/username/Sites/phiw13-local/textpattern/include/txp_image.php(1123): txp_thumb->write() #2 /Users/username/Sites/phiw13-local/textpattern/include/txp_image.php(64): thumbnail_create() #3 /Users/username/Sites/phiw13-local/textpattern/index.php(230): include('/Users/username/S...') #4 {main} thrown in /Users/username/Sites/phiw13-local/textpattern/lib/class.thumb.php on line 334

and finally smd_thumbnail latest patch, shorter:

Fatal error: Uncaught DivisionByZeroError: Division by zero in /Users/username/Sites/phiw13-local/textpattern/lib/class.thumb.php:240 Stack trace: #0 /Users/username/Sites/phiw13-local/plugin_core/smd_thumbnail/smd_thumbnail.php(420): wet_thumb->write('/Users/username/S...', '/Users/username/S...') #1 /Users/username/Sites/phiw13-local/plugin_core/smd_thumbnail/smd_thumbnail.php(478): smd_thumb->write_image() #2 /Users/username/Sites/phiw13-local/plugin_core/smd_thumbnail/smd_thumbnail.php(678): smd_thumb_make(Array, Array, 1) #3 /Users/username/Sites/phiw13-local/textpattern/lib/txplib_misc.php(1589): smd_thumb_edit('image_ui', 'thumbnail_edit', '\n<form class="u...', Array) #4 /Users/username/Sites/phiw13-local/textpattern/lib/txplib_admin.php(791): callback_event('image_ui', 'thumbnail_edit', 0, '\n<form class="u...', Array) #5 /Users/username/Sites/phiw13-local/textpattern/include/txp_image.php(665): pluggable_ui('image_ui', 'thumbnail_edit', '\n<form class="u...', Array) #6 /Users/username/Sites/phiw13-local/textpattern/include/txp_image.php(64): image_edit() #7 /Users/username/Sites/phiw13-local/textpattern/index.php(230): include('/Users/username/S...') #8 {main} thrown in /Users/username/Sites/phiw13-local/textpattern/lib/class.thumb.php on line 240

Hope that helps some, but, dunno, given your (Oleg) comments above. Depending on how energy you have, fixing is possibly problematic. As Pete suggest, postponing to a later release is an option.


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

Offline

#20 2021-12-09 11:42:58

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

Re: php 8.1

I still hope to make AVIF work in 4.8.8, at least partially.

Offline

#21 2021-12-09 21:40:45

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

Re: php 8.1

Please retest image operations in 4.8.8, be it PHP 8.1 or not. Thanks.

Offline

#22 2021-12-10 00:46:08

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

Re: php 8.1

Uploading JPG/PNG/WEBP: OK. Thumbnail generation for those images: OK.

Uploading AVIF images: nothing anymore. Image is not uploaded, there is no TXP message and no debug messages/warnings/errors

Firefox and Safari, with and without smd_thumbnails (I went as far as completely uninstalling the plugin…).


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

Offline

#23 2021-12-10 08:14:24

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

Re: php 8.1

BTW – installing 4.8.8latest with PHP 8.1.0 + MySQL 8.0.* goes well (success)/

BTW – quoting me above:

Click on the logout button (TR) triggers, after the “Are you sure?” browser dialog, a second browser dialog: “internal error”.

This error has now disappeared. TY.
Verified with 2 different installs, one an “old” one, and a freshly made new vanilla one.


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

Offline

#24 2021-12-10 09:17:24

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

Re: php 8.1

Accessing the Themes panel (vanilla install):

8192 "Return type of Textpattern\Iterator\RecFilterIterator::getChildren() should either be compatible with RecursiveFilterIterator::getChildren(): ?RecursiveFilterIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"
in /Users/username/Sites/_txp-dev/textpattern/vendors/Textpattern/Iterator/RecFilterIterator.php at line 68.

textpattern/vendors/Textpattern/Loader.php:152 adminErrorHandler()
textpattern/vendors/Textpattern/Loader.php:152 require_once()
Textpattern\Loader->load()
textpattern/vendors/Textpattern/Container/Container.php:116 method_exists()
textpattern/vendors/Txp.php:54 Textpattern\Container\Container->getInstance()
textpattern/vendors/Textpattern/Skin/CommonBase.php:495 Txp::get()
textpattern/vendors/Textpattern/Skin/Skin.php:385 Textpattern\Skin\CommonBase->getFiles()
textpattern/vendors/Textpattern/Skin/Skin.php:410 Textpattern\Skin\Skin->setUploaded()
textpattern/vendors/Textpattern/Skin/Skin.php:1207 Textpattern\Skin\Skin->getUploaded()
textpattern/vendors/Textpattern/Skin/Skin.php:1188 Textpattern\Skin\Skin->getImportForm()

8192 "Return type of Textpattern\Iterator\RecFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"
in /Users/username/Sites/_txp-dev/textpattern/vendors/Textpattern/Iterator/RecFilterIterator.php at line 77.

textpattern/vendors/Textpattern/Loader.php:152 adminErrorHandler()
textpattern/vendors/Textpattern/Loader.php:152 require_once()
Textpattern\Loader->load()
textpattern/vendors/Textpattern/Container/Container.php:116 method_exists()
textpattern/vendors/Txp.php:54 Textpattern\Container\Container->getInstance()
textpattern/vendors/Textpattern/Skin/CommonBase.php:495 Txp::get()
textpattern/vendors/Textpattern/Skin/Skin.php:385 Textpattern\Skin\CommonBase->getFiles()
textpattern/vendors/Textpattern/Skin/Skin.php:410 Textpattern\Skin\Skin->setUploaded()
textpattern/vendors/Textpattern/Skin/Skin.php:1207 Textpattern\Skin\Skin->getUploaded()
textpattern/vendors/Textpattern/Skin/Skin.php:1188 Textpattern\Skin\Skin->getImportForm()

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

Offline

#25 2021-12-10 10:27:01

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

Re: php 8.1

phiw13 wrote #332161:

BTW – installing 4.8.8latest with PHP 8.1.0 + MySQL 8.0.* goes well (success)/

Phew! I was going to lawsuit php 8.1 for the lost hair…

phiw13 wrote #332162:

Accessing the Themes panel (vanilla install):

8192 "Return type of Textpattern\Iterator\RecFilterIterator::getChildren() should either be compatible with RecursiveFilterIterator::getChildren(): ?RecursiveFilterIterator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"...

… and I guess I will do

Offline

#26 2021-12-13 02:32:50

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

Re: php 8.1

Good morning, Oleg.

etc wrote #332164:

Phew! I was going to lawsuit php 8.1 for the lost hair…

… and I guess I will do

PHP 8.1 brought to you thanks to generous donation from Big Hair Implant, Inc.
Take care!

Looks like you have fixed most errors over the WE. TY. After some more testing, I have not anymore issues at the moment.

I still have that image upload issue with AVIF files.

  1. it fails
  2. there are no Textpattern messages and
  3. a get this in the console (default, vanilla install, no plugins):
Uncaught SyntaxError: expected expression, got '<'
    jQuery 27
    txpFileupload http://txpdev.local/textpattern/textpattern.js:1908
    jQuery 2
index.php:5
    jQuery 27
    txpFileupload http://txpdev.local/textpattern/textpattern.js:1908
    jQuery 2

That syntax error only appears with AVIF files. As mentioned earlier, uploading and editing other image formats works perfectly fine, including thumbnail generation.


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

Offline

#27 2021-12-13 07:38:55

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

Re: php 8.1

phiw13 wrote #332187:

Uncaught SyntaxError: expected expression, got '<'...

Philippe, could you please inspect the raw server response in the browser console when you upload an avif file? Because everything works fine on my side.

Offline

#28 2021-12-13 07:47:06

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

Re: php 8.1

etc wrote #332190:

Philippe, could you please inspect the raw server response in the browser console when you upload an avif file? Because everything works fine on my side.

Is this what you (don’t) want to see?

;
window.alert("Warning \"imagecreatefromavif(): AVIF image support has been disabled\n\"\nin /Users/username/Sites/_txp-dev/textpattern/lib/txplib_admin.php at line 509.\nadminErrorHandler()\ntextpattern/lib/txplib_admin.php:509 imagecreatefromavif()\ntextpattern/lib/txplib_admin.php:570 txpimagesize()\ntextpattern/include/txp_image.php:827 image_data()\ntextpattern/include/txp_image.php:64 image_insert()\ntextpattern/index.php:230 include()");
;
window.alert("Warning \"imagecreatefromavif(): &quot;/Users/username/Sites/_txp-dev/textpattern/tmp/txp_TkhIy3&quot; is not a valid AVIF file\"\nin /Users/username/Sites/_txp-dev/textpattern/lib/txplib_admin.php at line 509.\nadminErrorHandler()\ntextpattern/lib/txplib_admin.php:509 imagecreatefromavif()\ntextpattern/lib/txplib_admin.php:570 txpimagesize()\ntextpattern/include/txp_image.php:827 image_data()\ntextpattern/include/txp_image.php:64 image_insert()\ntextpattern/index.php:230 include()");
<br />
<b>Fatal error</b>:  Uncaught TypeError: imagesx(): Argument #1 ($image) must be of type GdImage, bool given in /Users/username/Sites/_txp-dev/textpattern/lib/txplib_admin.php:510
Stack trace:
#0 /Users/username/Sites/_txp-dev/textpattern/lib/txplib_admin.php(510): imagesx(false)
#1 /Users/username/Sites/_txp-dev/textpattern/lib/txplib_admin.php(570): txpimagesize('/Users/username/S...')
#2 /Users/username/Sites/_txp-dev/textpattern/include/txp_image.php(827): image_data('/Users/username/S...', Array, 0, true)
#3 /Users/username/Sites/_txp-dev/textpattern/include/txp_image.php(64): image_insert()
#4 /Users/username/Sites/_txp-dev/textpattern/index.php(230): include('/Users/username/S...')
#5 {main}
  thrown in <b>/Users/username/Sites/_txp-dev/textpattern/lib/txplib_admin.php</b> on line <b>510</b><br />

Firefox, network tab, response subtab. Vanilla TXP, up-to-date according to Git.


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

Offline

#29 2021-12-13 08:56:49

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

Re: php 8.1

Hmm, looks like a libgd issue. GD library bundled with php 8.1 for windows works fine (up to a weird flip on thumbnail creation). Are you sure to have the latest php distro?

Offline

#30 2021-12-13 09:05:40

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

Re: php 8.1

Are you sure to have the latest php distro?

According to Homebrew everything is up-to-date.

$ php -v
PHP 8.1.0 (cli) (built: Nov 28 2021 14:43:54) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies

More I can’t do to get it to work locally, atm


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

Offline

Board footer

Powered by FluxBB