Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 #347

Open
Torsten-K opened this issue Jun 19, 2022 · 15 comments
Open

PHP 8 #347

Torsten-K opened this issue Jun 19, 2022 · 15 comments

Comments

@Torsten-K
Copy link

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
Copy link
Contributor

kicken commented Jun 21, 2022

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
Copy link
Member

Schlaefer commented Jun 21, 2022

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
Copy link
Author

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

@Schlaefer Schlaefer pinned this issue Jul 21, 2022
@Schlaefer
Copy link
Member

Schlaefer commented Jul 21, 2022

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
Copy link
Contributor

kicken commented Jul 21, 2022

@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
Copy link
Member

@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
Copy link
Author

@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
Copy link
Member

Schlaefer commented Jul 21, 2022

@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
Copy link
Author

@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
Copy link
Member

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

@Schlaefer
Copy link
Member

Schlaefer commented Jul 22, 2022

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

  • File: lib/Phile/Plugin/AbstractPlugin.php
  • Line: $globals['plugins'][$pluginKey]['settings'] = $this->settings;
  • Currently here

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
Copy link
Author

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

@Schlaefer
Copy link
Member

Schlaefer commented Jul 28, 2022

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
Copy link
Member

Schlaefer commented Jul 29, 2022

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
Copy link

iaian7 commented Sep 3, 2022

@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:

  • phile twigFilters
  • phile rssFeed
  • phile xmlsitemap
  • phile phpFastCache
  • siezi phileTotalCache
  • (I've also tried phile simpleFileDataPersistence, and always seem to run into issues I don't fully understand with optimisation/caching plugins...baseline recommendations would be great for new users)

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.

  • InlineMedia is designed to take image names or Vimeo/YouTube links and turn them into code. Unlike the original plugin, it uses directories alongside the Markdown page for images so it's extra-easy to track what files go with what page. Lets me review page content without opening folders, while still keeping the images alongside them. Though perhaps this is incorrect/poor usage of the intended system? I'm not sure if having MD files outside a folder of the same name is highly innapropriate or not for how Phile is designed. There's also a branch of this plugin for a single website where I needed very specific inline GIF embedding features.

  • MetaList converts a comma separated meta tag into an html list. Super simple, I only made it to make my portfolio website content easier to manage.

  • MetaVid converts a Vimeo ID meta tag into embed code. Another one-off plugin to make content for a singular website easier to manage.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants