plegall / piwigo-permalink-generator

1 stars 2 forks source link

PHP error - Undefined variable "active_permalinks" #1

Open crisc2000 opened 6 years ago

crisc2000 commented 6 years ago

I had 31 physical albums with no permalinks created. When I pressed "generate permalinks" button, I got this errors:

Notice: Undefined variable: active_permalinks in /.../www/local/piwigo/plugins/permalink_generator/admin.php on line 81 
Warning: Cannot modify header information - headers already sent by (output started at /.../www/local/piwigo/plugins/permalink_generator/admin.php:81) in /.../www/local/piwigo/include/page_header.php on line 101 

But the permalinks where successfully created.

Then I manually added a new virtual subalbum in one of those physical albums. I pressed "generate permalinks" again. No error second time.

PHP: 5.6 Piwigo: 2.9.2 Other plugins: Admin tools, Local files editor

crisc2000 commented 3 years ago

this is because $active_permalinks is not defined as an empty array before looping (like $missing_permalinks is). so if no permalink exist already in the database, when is called as a function argument it give an error.