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

Processing broken under PHP 8.1 after Ubuntu release upgrade #13

Open
jheidel opened this issue Nov 25, 2022 · 0 comments · May be fixed by #14
Open

Processing broken under PHP 8.1 after Ubuntu release upgrade #13

jheidel opened this issue Nov 25, 2022 · 0 comments · May be fixed by #14

Comments

@jheidel
Copy link

jheidel commented Nov 25, 2022

This project broke for me after migration from Ubuntu 20.04 to 22.04. I think the default PHP version was bumped from 7 to 8 as part of this upgrade which is likely responsible.

$ php -v
PHP 8.1.2-1ubuntu2.9 (cli) (built: Oct 19 2022 14:58:09) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.9, Copyright (c), by Zend Technologies

I'm getting the following error:

$ /bin/bash find.sh /data/share/downloads/ > /tmp/find.txt
$ cat /tmp/find.txt | /usr/bin/php process.php -v -vv /tmp/report
PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/jeff/sources/diskusagereports/scripts/process.php on line 286
  Processing filelist...
  Processing header...
FAIL: The header line in the <filelist> is invalid:
#

I'm no expert in php, but I found that after making the following changes I was able to get it to work:

  • Class constructors need to use __construct() or else they don't run
  • The comparator function needs to be static or this throws an error
  • Switch to break instead of continue inside switch (fix warning)

After making these changes the report appears to be generated correctly.

cat /tmp/find.txt | /usr/bin/php process.php -v /data/media/test/report
  Processing filelist...
  Saving dir tree...
  Saving settings...
  Complete! Processed 6,762 lines from 810.04 KB, wrote 1.61 MB in 1,056 files, took 0 seconds.

I will submit these fixes as a pull request. I'm not sure if this project is still maintained but even if not hopefully this will save someone else some debugging time.

jheidel added a commit to jheidel/diskusagereports that referenced this issue Nov 25, 2022
@jheidel jheidel linked a pull request Nov 25, 2022 that will close this issue
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 a pull request may close this issue.

1 participant