SimpleMachines / SMF

Simple Machines Forum — SMF in short — is free and open-source community forum software, delivering professional grade features in a package that allows you to set up your own online community within minutes!
https://www.simplemachines.org/
Other
592 stars 255 forks source link

[3.0] & [2.1]: php 8.3 - Blank screen viewing source in error log code popup window #8307

Open sbulen opened 2 months ago

sbulen commented 2 months ago

Basic Information

The popup window to view source in the error log doesn't work in PHP 8.3.

This is true for 2.1 & 3.0. PHP 8.2 works fine.

No issue logged, in smf, php or apache error logs. Nothing in the console either.

From the forum: https://www.simplemachines.org/community/index.php?topic=589529.0

Steps to reproduce

  1. Set php version to 8.3.
  2. Open the error log, click on the source/line link to view source.

Expected result

This is what it looks like in php 8.2: image

Actual result

This: image

Version/Git revision

3.0 Alpha 2 & 2.1.4

Database Engine

All

Database Version

8.4

PHP Version

8.3.8

Logs

Nothing found in any log...

Additional Information

No response

sbulen commented 3 weeks ago

The root of the issue here is that in PHP 8.3, significant changes were made to php's to highlight_string()... https://php.watch/versions/8.3/highlight_file-highlight_string-html-changes

highlight_string() is used in our highlightPhpCode() function.

In particular, highlight_string() no longer returns line feeds as <br />.

jdarwood007 commented 3 weeks ago

Looks like we need to version sniff to handle the output properly then.

sbulen commented 3 weeks ago

There is logic there already for 8.3, but I think it needs a tweak or two.

I'm working on a PR.