PhileCMS / Phile

A flat file CMS with a swappable parser and template engine.
https://philecms.github.io/
Other
255 stars 48 forks source link

PHP 8 #347

Open Torsten-K opened 2 years ago

Torsten-K commented 2 years ago

Will there be a version which works under PHP 8.0? The recent version 1.11.1 does not. Or has the development been stopped?

kicken commented 2 years ago

I've made a pull request (#348) that makes updates for PHP 8.0 compatibility. Not sure if the project has anyone actively monitoring it these days that would be able to accept and create a new release.

Schlaefer commented 2 years ago

OK, since there seems to be interest lets get a PHP 8 release out of the door. I'm going to review the PR, but it may take a few days. My whole Phile dev knowledge is completely swapped out at the moment, so I'm a little bit rusty too.

It would be helpful if you can list the (official) plugins you use to assess potential backwards compatibility issues.

Torsten-K commented 2 years ago

@Schlaefer: I downloaded and installed your fork. Unfortunately, blank page in my case. Apache 2.4, PHP 8.0.

Schlaefer commented 2 years ago

OK, I started on my own branch, which looks very promising so far: https://github.com/Schlaefer/Phile/tree/feature/php8

The biggest outstanding point seems to be the version bump on composer affecting "install plugins through composer" ("phile-cms/plugin-installer-plugin"). It was originally implemented by afaik @NeoBlack and I have no clue how it all works, so I have to do some reading first. Or can somebody else jump in on that issue?

kicken commented 2 years ago

@Schlaefer as far as I could tell it just is a small composer plugin that causes phile-plugin packages to be installed into the plugins folder instead of the vendor directory. I made updates to that repository as well as part of my changes. The updates are minimal, just adding new methods to the plugin class. I've opened a PR request (#3) there with the changes.

Schlaefer commented 2 years ago

@kicken Thanks! I'm going to update a plugin and check if everything works.

Here's a release package from my branch for testing: phile-feature-php8-head.zip

Torsten-K commented 2 years ago

@Schlaefer

Here's a release package from my branch for testing: phile-feature-php8-head.zip

This works under PHP 8.0. Good work, thank you!

Under PHP 8.1, there appears the following error, regarding lib/Phile/Model/AbstractModel.php: During inheritance of ArrayAccess: Uncaught Whoops\Exception\ErrorException: Return type of Phile\Model\AbstractModel::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in lib/Phile/Model/AbstractModel.php etc. No big problem so far, I just wanted to tell you.

Schlaefer commented 2 years ago

@Torsten-K Thanks for testing, I'm able reproduce and going to look into it.

We ran automated tests on all supported PHP versions in the cloud in the past, which should hopefully catch these issues. Alas that infrastructure needs an update too. That said personal feedback is always the better feedback.

Since "We're Doing It"™ I don't intent do half-ass the update but have a proper release which includes said infrastructure in place, even if it takes a little bit longer. Have the house in order.

Torsten-K commented 2 years ago

@Schlaefer

even if it takes a little bit longer

Never mind. Good things take time. Null Problemo. Gut Ding will Weile haben, wie wir Deutschen sagen.

Schlaefer commented 2 years ago

New build which should fix all the PHP 8.1 issues: phile-feature-php8-head.zip

Schlaefer commented 2 years ago

For anyone who has a running installation no matter PHP 7 or 8 can you please test something.

Can you remove that line and look if anything breaks please (don't forget to disable the cache plugin)?

That line gives me a little bit of an headache and I'm not exactly sure why we need it. Looks like very old backwards compatibility for maybe plugins that would break with a PHP 8 update anyway. Being able to remove it would be great.

Nevermind, the headache turned out to be a symptom of a structural problem in the app. I think I found the proper solution.

New build: phile-feature-php8-head.zip

Currently I have no known issues anymore.

Torsten-K commented 2 years ago

I can confirm that this build works under PHP 8.1. Kudos to @Schlaefer!

Schlaefer commented 2 years ago

Since I don't expect really old plugins to work without modification in PHP 8 either I consider this a breaking release and plan to release it as 2.0. Under that premise this is the opportunity to remove deprecated cruft which was always kept around for said plugins (only code that was marked @deprecated in the past is affected).

If someone has an issue with an older plugin it's better to update the plugin, which we can do if the original author abandoned it, the necessary change should be minor. But I don't see that dogmatic, if somebody says "I really need this back" we put it back in a 2.1.

Input appreciated. And again: if your installation depends on additional plugins post them here so we can take a look if they are affected by this change or PHP 8.

Here's a new build with all the deprecated stuff removed: phile-feature-removeDeprecated-head.zip

Schlaefer commented 2 years ago

Since we're doing a new "major" version bump which could indicate a flurry of development I want to manage expectations a little bit. In the readme of the front page I consider to put below the Why use PhileCMS:


Should You use PhileCMS

The strengths of Phile are its performance, easy installation, but most importantly its flexibility. You like to write your content in AsciiDoc instead of Markdown? Replace the default Parser-plugin with a AsciiDoc one.

Most flat-file-CMS are opinionated about many aspects and develop features according to that chosen path. Phile is not. Phile is a great starting point if you want flexibility, but you probably have to write or install a few plugins to fit it to your needs.

If you're are searching for a two-click blogging solution, download a theme and be done Phile probably isn't for you. You have to invest some time to make it what you want it to be. If you acquired some knowledge in PHP, HTML, CSS, etc. or enjoy discovering it and aren't afraid of editing text-configuration files Phile is for you.

For the same reason don't expect much core (feature) development, you should be able to bring all additional functionality via a plugin. Either you write your own plugin - which Phile empowers you to do - or discover an existing one [1] [2].

[1] https://github.com/topics/philecms-plugin [2] https://github.com/topics/philecms


Feedback appreciated.

iaian7 commented 1 year ago

@Schlaefer I'm happy to see updates for Phile CMS underway! I've been following this conversation since it started, but haven't had a chance to test out the new build yet myself.

Regarding "should you use Phile", I think what you've written expresses the goal well and sets fairly clear expectations. My own usage has been, perhaps, borderline; I can fumble around with some very basic PHP, but not enough to understand how the system really works. So far I've liked Phile CMS, and hacked together some of my own plugins, but I know I can't maintain it myself if the core isn't updated...along with some amount of plugin support too (I can modify simple examples, not so much write them from scratch).

Regarding what plugins are in active use, here's what I'm currently using across three different sites:

I don't currently use it, but will need stijnFlipper philePaginator soon if I'm going to use Phile on new projects.

I've also hacked together some of my own plugins based on the PhileInlineImage example. Don't let today's GitHub commits fool you, this was all started back in 2016, I'm only now getting stuff posted publicly.

Again, happy to see Phile CMS getting some updates and a cleanup of old backwards compatibility code sounds good. Thank you for working on this project!