smogon / pokemon-showdown-client

The client for Pokémon Showdown
http://pokemonshowdown.com
GNU Affero General Public License v3.0
560 stars 786 forks source link

Reload custom CSS - HTTP ERROR 500 #2119

Closed DieterReinert closed 1 year ago

DieterReinert commented 1 year ago

Whenever trying to reload custom CSS we get a HTTP ERROR 500.

This started happening after the issue where https://play.pokemonshowdown.com/ was unavailable because they had to move to a new server.

DieterReinert commented 1 year ago

bump

monsanto commented 1 year ago

i fixed an error that may be related to this

mia-pi-git commented 1 year ago

This is 500'ing because we never set a directory for css on the new loginserver, as far as I can tell. I just set it and rebooted, so it should work now.

DieterReinert commented 1 year ago

I just tested and was still getting it. I'll later tonight at my personal computer.

Currently at work. Will keep you posted

mia-pi-git commented 1 year ago

Please try again? Re-targeted it to a new directory instead of the old one.

DieterReinert commented 1 year ago
image
DieterReinert commented 1 year ago

The issue is still there...

DieterReinert commented 1 year ago

Any update?

DieterReinert commented 1 year ago

@mia-pi-git said they were going to look at the php for the customcss, but the issue is still there any idea when we could expect a update on this?

DieterReinert commented 1 year ago

The issue is still there

monsanto commented 1 year ago

Nobody is currently working on this, sorry. Maybe @Zarel will fix it

monsanto commented 1 year ago

Someone tagged me about this so I took a second to see what it is. My guess is that the CSS sanitizer library doesn't play nicely with the version of PHP we're using (8.1.2).

The error is

PHP Parse error: syntax error, unexpected token "match", expecting variable in lib/css-sanitizer/Wikimedia/CSS/Grammar/Matcher.php on line 121

Maybe this will give a starting point for someone to fix this error. Sorry I cannot be of more help.

DieterReinert commented 1 year ago

@monsanto @Zarel it is because "Match" in php 8+ is a keyword. If you look at line 121: private static function collectSignificantWhitespace( Match $match, &$ret = [] ) {

It uses Match as a type here which is not allowed in PHP 8+.

In the update code (found here: https://github.com/wikimedia/css-sanitizer/tree/master/src) it is like this: private static function markSignificantWhitespace( $list, $match, $significantWS, $end ) {

Which should solve the issue potentially. (this should be replaced with the link above: https://github.com/smogon/pokemon-showdown-client/tree/master/lib/css-sanitizer/Wikimedia/CSS)

monsanto commented 1 year ago

A PR that renames the new keyword may be the easiest fix, if someone wants to do it. Alternatively the library could be upgraded but that might introduce other compatibility problems and would require someone with a working client setup to test.

Starmys commented 1 year ago

https://github.com/smogon/pokemon-showdown-client/pull/2126 Tried to fix it by upgrading the library.

DieterReinert commented 11 months ago

Same error is back, might be due to the recent refactors

Zarel commented 11 months ago

(Fixed again in bd134f4ccf541378979c.)