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

feat: upgrade monolog/monolog to v3 #332

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

kolaente
Copy link

Resolves #331

This probably needs some more fixing. I've added the nix flake to be able to run composer et al, can remove it if you don't need it.

I had to upgrade j0k3r/php-readability to dev-master because monolog now requires psr/log in at least version 3 and the last release only supports v1. As such, this is probably not mergable right now because we now have a dependency on master from that package which will give users something different every time. If you release a new version of that package, I'll happily pin it to that release version.

As per monolog's release docs, the minimum required php version is now 8.1 so I upgraded that as well. I think I migrated all uses of it but I'm not 100% sure. This probably needs more testing from someone who knows how that feature works.

@kolaente
Copy link
Author

I guess the tests need an update because we now need 8.1. Should I change them? This probably has other implications I'm not aware of.

@jtojnar
Copy link
Collaborator

jtojnar commented Jun 23, 2023

I am afraid raising minimum PHP version at this time is not in line with for Graby primary consumers. Both Wallabag and selfoss still target PHP 7.4. And while I am open to potentially raising it in selfoss, I would still want to support PHP 8.0 at least until it no longer has upstream security support.

@kolaente
Copy link
Author

Yeah that makes sense. Given that php 8.0 will be eol in November, should I pick this up again at that time?

@jtojnar
Copy link
Collaborator

jtojnar commented Jun 23, 2023

If you are willing to implement it, supporting Monolog ^2.4||^3.0 in master is probably the best solution to make Graby usable with project that require 3.0 now.

I would not bet on dropping PHP 8.0 support in November. There are still distros where PHP 8.0 or even 7.4 will be supported for the next while. For example, Debian 11, which ships PHP 7.4, will continue to receive security updates for three more years.

@kolaente
Copy link
Author

If you are willing to implement it, supporting Monolog ^2.4||^3.0 in master is probably the best solution to make Graby usable with project that require 3.0 now.

Done

@kolaente
Copy link
Author

Now the tests fail with the same issue as in #333

"ext-curl": "*",
"ext-tidy": "*",
"fossar/htmlawed": "^1.2.8",
"guzzlehttp/psr7": "^2.0",
"j0k3r/graby-site-config": "^1.0.147",
"j0k3r/httplug-ssrf-plugin": "^2.0",
"j0k3r/php-readability": "^1.2.9",
"monolog/monolog": "^1.18.0|^2.3",
"j0k3r/php-readability": "dev-master",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason you are bumping readability?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of psr/log, it's detailed in the PR description

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because readability 1x only supports psr/log 1.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I try 2.0.2?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can put ^2.0 it'll be enough for the psr/log v3

flake.nix Outdated
pkgs.mkShell {
buildInputs = with pkgs; [
(php82.withExtensions
({ all, ... }: with all; [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if @j0k3r wants to include Nix packaging. I could continue to maintain it for the time being as I use something like this locally.


It might be sufficient to use enabled attribute to load the default extensions:

https://github.com/fossar/selfoss/blob/b0eb43d80bedde5da3204b842511afe245d8c17c/flake.nix#L37-L40

And make the PHP version parametric:

https://github.com/fossar/guzzle-transcoder/blob/816585c89c87268d1188d2d9696b49ce73541ff9/flake.nix#L29

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can maintain it, I'm ok.
I didn't what Flake was.
Maybe put a comment at the very top of flake.nix with a link to sth that explain what it does/is.

flake.nix Outdated Show resolved Hide resolved
@@ -15,15 +15,15 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.4",
"php": ">=7.4|>=8.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is superfluous.

* @param string $th Row header content
* @param string $td Row standard cell content
* @param bool $escapeTd false if td content must not be html escaped
*/
private function addRowWithLevel(int $level, string $th, string $td = ' ', bool $escapeTd = true): string
private function addRowWithLevel(Level $level, string $th, string $td = ' ', bool $escapeTd = true): string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work with Monolog 2, will it?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least there is a specific build to run on lower deps, so it's checked https://github.com/j0k3r/graby/actions/runs/5375860418/jobs/9752256955?pr=332#step:4:115

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm getting this error, I think I have monolog 2 installed.

Graby\Monolog\Formatter\GrabyFormatter::addRowWithLevel(): Argument #2 ($th) must be of type string, int gi

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

Successfully merging this pull request may close these issues.

Using Graby with Laravel
4 participants