PHP 8.3 and 8.4

General information and announcements regarding the FlatPress project
User avatar
Torsten
Posts: 5
Joined: Fri Apr 09, 2021 6:53 pm

PHP 8.3 and 8.4

Post by Torsten » Tue Jan 14, 2025 10:32 pm

After updating PHP from 8.2 to 8.4, my FlatPress installation (version 1.3.1) only shows a white page, the same with PHP 8.3. Will there be a new FlatPress version in the near future, which runs under PHP 8.4?
On Error GoTo Bed

User avatar
fraenkiman
Posts: 294
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: PHP 8.3 and 8.4

Post by fraenkiman » Fri Jan 17, 2025 11:06 am

Hello Torsten,

I was hoping for a release on the 20th anniversary (around February 15, 2026). There is currently no release canidate. You are welcome to test the current master branch (Changelog) under PHP8.4.

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

laborix
Posts: 140
Joined: Sat Feb 16, 2019 3:51 pm

Re: PHP 8.3 and 8.4

Post by laborix » Fri Jan 17, 2025 2:15 pm

fraenkiman wrote: Fri Jan 17, 2025 11:06 am... You are welcome to test the current master branch under PHP8.4 ...
Quick&dirty test, add comment, enable comment, add new entry, preview entry, activate some plugins and change the main FlatPress 1.4 dev (Github 1820) title.
Cool, also the calender plugins is working :D

Tested current FlatPress Github 1820 version on Apache with PHP 8.4.3.

Ok, found one PHP warning in the PHP errorlog:

Code: Select all

PHP Warning:  Language configuration is incomplete in /fp14dev/fp-interface/lang/en-us/lang.conf.php in /fp14dev/fp-includes/core/core.language.php on line 148
best regards

User avatar
fraenkiman
Posts: 294
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: PHP 8.3 and 8.4

Post by fraenkiman » Sat Jan 18, 2025 12:53 pm

Hello laborix,

Thank you for the Quick & Duty test. You are welcome to extend the test depth :smirk: .

I can't explain the entry in your PHP log from your comment. The set_locale function is currently only used in the extended blog search function to localize the month name with the Smarty function html_select_date. The set language is fired on LC_TIME.

Can you reproduce the error specifically?

Best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

laborix
Posts: 140
Joined: Sat Feb 16, 2019 3:51 pm

Re: PHP 8.3 and 8.4

Post by laborix » Sat Jan 18, 2025 3:32 pm

fraenkiman wrote: Sat Jan 18, 2025 12:53 pm... You are welcome to extend the test depth :smirk: ...
Hi Frank,
In my opinion, this is the task of the developer, not the user :D

Ok, back to Fp14 dev, possible starting points, but you would have to ask Arvid (clearly more experienced):

Starting point 1:

In the /fp14dev/fp-includes/core/core.language.php

Code: Select all

line 148: if (!isset(... , $langconf [‘charsets’], ...)) 
the $var with charsets is queried as a one-dimensional array, but stored in the
/fp14dev/fp-interface/lang/en-us/lang.conf.php

Code: Select all

line 5: $langconf [‘charsets’] [0] = ‘utf-8’;
line 6: $langconf [‘charsets’] [1] = ‘iso-8859-15’;
as a multidimensional array.
This means that the query above is no longer permitted (presumably as of PHP 8.2/PHP 8.3).


Starting point 2:
I'm totally unsure, as I don't work with trigger_error() myself.
Theoretically, you could comment out the trigger_error() and see if the PHP warning disappears

have a nice Weekend

User avatar
fraenkiman
Posts: 294
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: PHP 8.3 and 8.4

Post by fraenkiman » Sat Jan 18, 2025 6:04 pm

Hello laborix,

Thank you for your feedback. I have implemented a fallback solution and secured the array access. That should make the function robust enough.
laborix wrote: Sat Jan 18, 2025 3:32 pm In my opinion, this is the task of the developer, not the user :D
I agree with you. The developer has to test his construct himself. From my point of view, however, developers are also dependent on tests and feedback from the community, as developers usually only have one test environment at their disposal. On other environments, the behavior may differ depending on the configuration. FlatPress also has a long update interval. I therefore think it is all the more important that the community is involved in the preliminary tests so that there are no unexpected surprises in the later release.

Example:
I work in a medium-sized company that develops hardware and software. We also rely on tests and feedback from customers and other colleagues in-house. Even if everything works as expected from the developer's point of view, it doesn't necessarily work for the user.

Have a relaxing weekend
Best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

laborix
Posts: 140
Joined: Sat Feb 16, 2019 3:51 pm

Re: PHP 8.3 and 8.4

Post by laborix » Sun Jan 19, 2025 10:30 am

fraenkiman wrote: Sat Jan 18, 2025 6:04 pm... as developers usually only have one test environment at their disposal ...
As a starting point, a standard notebook from the business sector with 8GB RAM, a processor and an SSD disk:

Test environment Apache, PHP 5.x - 8.x, MySQL database
Test environment NGinx, PHP 8.x, PostgreSQL, MySQL database
Test environment Windows Server IIS, PHP 8.x, MSSQL database, MySQL database in a virtual box
Client test environment Linux, MacOS and Windows in a virtual box.

All this can be run in parallel and fully operational on a standard notebook from the business sector with 8GB RAM (in use for years). Professional software developers have 32GB and much more possibilities.

So I don't accept the argument with only one test environment :D

laborix
Posts: 140
Joined: Sat Feb 16, 2019 3:51 pm

Re: PHP 8.3 and 8.4

Post by laborix » Sun Jan 19, 2025 11:18 am

Test environment:
Apache 2.4.58, PHP 8.4.3, Windows platform

Ok, new test FlatPress 1.4-dev (Github 1833)
Everything seems to work, but there are new PHP warnings when using search button.

Code: Select all

PHP Warning:  Missing or invalid key in language configuration: localecountry_a. Using fallback value. in .../fp14dev/fp-includes/core/core.language.php on line 163
PHP Warning:  Missing or invalid key in language configuration: localecountry_b. Using fallback value. in .../fp14dev/fp-includes/core/core.language.php on line 163
PHP Warning:  Missing or invalid key in language configuration: charsets. Using fallback value. in .../fp14dev/fp-includes/core/core.language.php on line 163
PHP Warning:  Missing or invalid key in language configuration: localeshort. Using fallback value. in .../fp14dev/fp-includes/core/core.language.php on line 163
After importing an “ancient” FlatPress backup with 500 posts everything worked fine, unfortunately PrettyUrls seems to have some problems (404 - not found). After deactivating the PrettyUrls plugin you could click on each of the 500 entries again. But I have to test if this a data problem (FP 1.0.1 Backup 2012) or FP 1.4-dev.

Complaining at a high level
In the comments, meaningless domains are accepted for the web urls!
Example: https://test.iunteron

bets regards

laborix
Posts: 140
Joined: Sat Feb 16, 2019 3:51 pm

Re: PHP 8.3 and 8.4

Post by laborix » Sun Jan 19, 2025 3:37 pm

Whoever programmed this may have added a trigger_error() at this point just as internal developer info :roll: ?
A little debug run.

1. search field -> "features" used as search term
2. search button pressed
3. output of all entries containing the word “features"

My debug output for this:

Code: Select all

PHP Warning:  Missing or invalid key in language configuration: localecountry_a. Using fallback value. in ...core.language.php on line 163
Debugging 1:  Debug: key localecountry_a is empty!

PHP Warning:  Missing or invalid key in language configuration: localecountry_b. Using fallback value. in ...core.language.php on line 163
Debugging 1:  Debug: key localecountry_b is empty!

PHP Warning:  Missing or invalid key in language configuration: charsets. Using fallback value. in ...core.language.php on line 163
Debugging 1:  Debug: key charsets is empty!

PHP Warning:  Missing or invalid key in language configuration: localeshort. Using fallback value. in ...core.language.php on line 163
Debugging 1:  Debug: key localeshort is empty!
If I display the fallback solution, the following appears

Code: Select all

Debugging 1:  localecountry_a -> Fallback: = en_US
Debugging 1:  localecountry_b -> Fallback: = en-US
Debugging 1:  charsets        -> Fallback: = Array    <- multidimensional array() ?? same procedure as the posting (laborix, Fr Jan 17, 2025 3:15 pm) 
Debugging 1:  localeshort     -> Fallback: = en
You can now consider commenting out this trigger_error(), as FlatPress actually finds the entries that contain the search term and also displays these entries as search results.
The other starting point would be to determine why empty values are passed here?

best regards

User avatar
fraenkiman
Posts: 294
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: PHP 8.3 and 8.4

Post by fraenkiman » Sun Jan 19, 2025 9:36 pm

Hello Laborix,

I was the one who programmed that :flushed: . Good that you have several test environments. May I take advantage of that?
Of course I could comment out trigger_error(). But your trigger_error() output shows that the function does not work as expected. So as a fallback, LC_TIME is set to English, even though you may have set a different FlatPress language. The inner Monk in me says: This needs to be solved or at least the trigger needs to be found.

The lang.conf.php file is loaded correctly, but the values are later recognized as empty. The problem is probably due to a combination of faulty conditional logic (charsets array) and possible PHP cache issues or previous inclusion of a broken version of the file being affected.

Please replace the core.language.php with this one. In case you have activated OPcache, deactivate it as a cross-check.
core.language.zip
(4.42 KiB) Downloaded 20 times
With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests