towards-a-new-leftypol / leftypol_lainchan

Other
6 stars 8 forks source link

PHP 7.4 Compatibility #159

Open dedushka1 opened 3 years ago

dedushka1 commented 3 years ago

Hello vnuki.

My dying father told me he had a great regret. He said he wished he took better care of the things he he liked most.

Running PHP 7.4.14 I notice several compatibility errors. I like to document those here and potentially fix them for prosperous future.

inc/functions.php: Starting around line 234, an error of "Trying to access array offset on value of type null in ..." I think this may be caused by lack of $board variable being set.

Outdated Twig Library: The Twig library seems to make PHP 7.4.14 mad. We may need to upgrade it. The Twig Tinyboard Extension will need to be migrated. We will need to vendor Twig 1.x with composer.

I am researching if changes will have an effect and will report back.

towards-a-new-leftypol commented 3 years ago

At one point after a system upgrade we went from php 7.2 to 7.3 and it broke everything and php had to be downgraded. The main breaking change was basically the behavior of array access when the key is not present. This for the most part needed an isset call added to if statements but some cases were more involved. Rebuilding in particular got screwed way up.

dedushka1 commented 3 years ago

I did the issets for $board.

It looks like a lot has changed with Twig 1.x in 5 years :P

Should I edit the original issue or just add comments as I find things?

towards-a-new-leftypol commented 3 years ago

I think you should add comments here, and if there is anything major that needs to be overhauled we can make separate issues.

dedushka1 commented 3 years ago

Array access for the IP library needs to be updated.

Array and string offset access syntax with curly braces is deprecated in /data/proj/leftypol_lainchan/inc/lib/IP/Lifo/IP/BC.php at line 105

$x{$i} // --> $x[$i]
nonmakina commented 3 years ago

https://github.com/vichan-devel/vichan/commit/a2ba03849f3adefa745838bff626c8304eb3d8c7 relevant PR

nonmakina commented 3 years ago

Also relevant issues: https://github.com/vichan-devel/vichan/issues?q=label%3Aphp7x-regression+

nonmakina commented 3 years ago

https://github.com/vichan-devel/vichan/commit/3a41c24e6e5bcea2f4b9f328ddf5ff0cb8a8b2e8

towards-a-new-leftypol commented 3 years ago

Work is being done here https://github.com/towards-a-new-leftypol/leftypol_lainchan/pull/284 to address this issue.