Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Undefined index: size Photo.php 3.2.12 #208

Closed
jorismak opened this issue Feb 17, 2019 · 1 comment
Closed

Undefined index: size Photo.php 3.2.12 #208

jorismak opened this issue Feb 17, 2019 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jorismak
Copy link

After upgrading from an older version (3.1.xxx) to 3.2.12, most seemed to work fine, but some albums refused to open.

Some albums open fine, others won't.

The console of the browser would show the response failed with 'Bad Gateway'. Eventually finding the logs (linuxserver/lychee docker image used for running the app) it showed multiple lines likes this:

PHP message: PHP Notice:  Undefined index: size in /usr/share/webapps/lychee/php/Modules/Photo.php on line 812

Looking at my database, the 'size' column exists and is filled (NOT NULL) for all my photos.
Looking at line 812 of the Photo.php module I see this line:

                $photo['size']                  = $data['size'];

Replacing it with this:

                $photo['size']                  = isset($data['size']) ? $data['size'] : '';

fixes the problem and refreshing the album, it now loads!

Digging a bit deeper, that error line is in the function Photo::prepareData() and it gets called from Modules/Album.php:173. There is a switch statement before that (around line 130 in Album.php ) where a query gets picked and executed, selecting fields from the photos-table. There is no size column in those SELECT statements. Adding it in (and undoing the change made to Photo.php) also works and the album loads fine.

Steps to reproduce the issue

I don't know why some albums worked and others didn't. Maybe cache related, or maybe it depends on the query picked to get information. If it's a SELECT * then it worked, if it hand-picked columns to query and size wasn't included, it gave errors. I think something like that.

Output of the diagnostics (Settings => Diagnostics)

Diagnostics report everything OK and 'should be working', except for an empty Dropbox key which I don't use.

Browser and system

I tried with Firefox 65, Windows x64.
Like I said, for running Lychee it's running the linuxserver/lychee docker images. So if the sourcecode I mentioned doesn't make sense and seems old or messy, then it might be that the people maintaining that docker image made a booboo or started messing with the code.

@ildyria ildyria added the bug Something isn't working label Feb 17, 2019
@ildyria ildyria added this to the v3.2.13 milestone Feb 17, 2019
@d7415 d7415 self-assigned this Feb 17, 2019
@d7415 d7415 closed this as completed in b89ef1e Feb 17, 2019
@d7415
Copy link
Contributor

d7415 commented Feb 17, 2019

I was unable to reproduce it, but it looks like it should cause an error. I applied your suggested fix to Album.php instead of Photo.php as it should be more complete that way.

Thanks for reporting this and for doing the debugging for us 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants