goldsky / FileDownload-R

FileDownload snippet for MODX revolution
12 stars 7 forks source link

PHP 8 Compatibility #68

Open claytonk opened 2 years ago

claytonk commented 2 years ago

If anyone is still maintaining this, there are a couple updates required to make this script compatible with PHP 8:

In the snippet "FileDownload" line 673 contains a create_function call which is deprecated:

array_walk($scriptProperties, create_function('&$val', 'if (!is_array($val)) $val = trim($val);'));

This can be changed to:

array_walk($scriptProperties, function(&$val){if (!is_array($val)){ $val = trim($val); }});

In model/php5-utf8/UTF8.php there are two issues that need fixing:

inline '#' comments need to be changed to '//' all curly bracket references to characters within in a string such as: $char{1} need to be changed to $char[1]

With these changes it appears to work in PHP8

unze commented 1 year ago

Can you upload the changed files please?

claytonk commented 1 year ago

updates.zip

This zip contains the updated filedownload snippet and the UTF8.php script. I can't edit the source on the repository, I'm not the owner, and I don't know if anyone is maintaining it. It looks like it's been inactive for 7 years.

unze commented 1 year ago

thanks for uploading, unfortunately does not work for me with php 8.0 or 8.1

claytonk commented 1 year ago

What are you seeing in your PHP error log?

Clayton Kinney (mobile)

On Nov 20, 2022, at 7:55 AM, unze @.***> wrote:

 thanks for uploading, unfortunately does not work for me with php 8.0 or 8.1

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

unze commented 1 year ago

Unfortunately, even with the setting to output errors with E_ALL only a white page is displayed and also in the apache2 error.log there are no entries

Jako commented 1 year ago

Please check the version 3.0.0 on the MODX repository and on this fork: https://github.com/Jako/FileDownloadR