From [Forum, post 184470 by SA in topic 32250] Piwigo 13 and [Forum, post 184474 by Aby in topic 32250] Piwigo 13
I am Unable to download existing individual photos after the major upgrade.
Warning: Cannot modify header information - headers already sent in /var/www/html/piwigo/action.php on line 228
Warning: Cannot modify header information - headers already sent in /var/www/html/piwigo/action.php on line 228
Warning: Cannot modify header information - headers already sent in /var/www/html/piwigo/action.php on line 228
Warning: Cannot modify header information - headers already sent in /var/www/html/piwigo/action.php on line 228
Warning: Cannot modify header information - headers already sent in /piwigo/action.php on line 228
����JFIF``��C $.' ",#(7),01444'9=82<.342��C 2!
Offline
We have implemented a single change in action.php between Piwigo 12 and Piwigo 13 : [Github] Piwigo commit dd44d0e4
I would like you test the action.php file from Piwigo 12 and tell us if it works any better. You can download it on https://raw.githubusercontent.com/Piwig … action.php
Offline
Wow, I guess I don't download photos very often (from my own gallery, heh). I didn't notice this in any of the beta versions, but sure enough when I try to download a photo from both of my galleries (upgraded to 13.0), I get the raw file data in the browser window (garbage) instead of the file downloading.
I can confirm, however, that using the old action.php file seems to fix the issue.
Offline
I had no problem with the action.php file in Piwigo 12. I accepted a pull-request because some users had problems. I have no problem with the new action.php but if it's broken for many users, I'll make a rollback on this commit.
Offline
I could reproduce the headers sent problem. But instead of rolling back I suggest to move only the
foreach ($http_headers as $header)
loop before the
if (ob_get_length() !== FALSE)
but keep the ob_flush()/flush() change. With that, the problem is gone for me.
Though I have no idea how headers could had been sent before the foreach sending headers was executed..
Edit: I created PR https://github.com/Piwigo/Piwigo/pull/1749
Edit2: that https://www.php.net/manual/en/function.header.php sheds some light:
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called.
PHP is such a crap..
Offline
Hi erAck,
Did you test your solution with PHP 7.x and 8.x ?
Offline
I just tried on PIWIGO 13 and PHP 8.0 >> and it worked with no issues.
Nigel.
Last edited by Nigel-Aves (2022-10-20 03:51:55)
Offline