Announcement

#1 2021-10-02 09:46:19

nerdnils
Member
2021-10-02
4

Mugshot bug

Hi there,

i searched the forums, there seem to be other bugs in mugshot… but none I found refers to the line I get the error:

"
Warning
: unserialize() expects parameter 1 to be string, array given in
/mnt/RAID/www/piwigo/plugins/MugShot/main.inc.php
on line
249
"

Line may be different because I tried some of the fixes I found. Line 249 for me is:

$plugin_config = unserialize (conf_get_param(MUGSHOT_ID));

in function insert_tag_list()

any solution for this?

Offline

 

#2 2021-10-05 07:05:15

dd-b
Member
Minneapolis, MN USA
2018-04-16
70

Re: Mugshot bug

I get this too. I fixed it once in a private copy -- it's deprecated behavior in a PHP function, so it'll continue to work for a while and then break entirely in some future version of PHP. It gives the line, easy enough to fix in the PHP code after reading up on the function as I remember it.

As I recall there was a thread when I brought this up a while ago and several users helped figure out a better solution than my original one; which did work on my site.

(That was before the new release by the MugShot author, which fixed other things and added things but didn't address this; this isn't urgent, except the message is annoying. Looks like it's the same function though so the same fix should be good.)

Offline

 

#3 2022-01-30 17:55:36

jonscaife
Member
2022-01-30
1

Re: Mugshot bug

I remember fixing different errors to this with earlier versions, but those fixes didn't seem to help with this.  My coding skills aren't good enough to really understand what the function is meant to do, but I have implemented a fix which has stopped the error occuring and the plugin still seems to work.

I changed line 247 (and added another line below it) so it looks like...

  if ( is_string( conf_get_param(MUGSHOT_ID) ) ) $plugin_config = unserialize(conf_get_param(MUGSHOT_ID));
  else $plugin_config = conf_get_param(MUGSHOT_ID);

My guess is that maybe piwigo changed the function conf_get_param so that it returns an array rather than a serialised string and that the unserialize step isn't needed.  However, since I don't know if this really is the case or not the 2 lines above check if what is returned is a string or not.  If it's a string it will unserialize it, and if it isn't a string it skips the unserialize and just assumes it will be an array already.

If anyone with more knowledge has any improvements or insight that would be great - until then this at least seems to work?

Offline

 

#4 2022-03-29 07:08:04

trhessel
Member
2022-03-13
18

Re: Mugshot bug

Hi I am having a similiar error with mugshot, i have a fresh install of Piwigo and when in install the Mugshot pluging and activate it i get a small popup that says an error has occurred and the plug does not work. If I try to update it from 2.0.2 to 2.0.3 that fails as well. Digging through some logs I see:

[Sun Mar 27 05:34:10.344392 2022] [php7:warn] [pid 24417] [client 172.70.178.36:60076] PHP Warning:  [mysql error 1062] Duplicate entry 'MugShot' for key 'PRIMARY'\nINSERT INTO pi
wigo_config (param,value,comment) VALUES ("MugShot","","MugShot configuration values"); in /var/www/html/piwigo/include/dblayer/functions_mysqli.inc.php on line 847, referer: http
s://www.hessel.family/photos/admin.php?page=plugins


Any help with this would be greatly appreciated, everyting seems to be working with all this except this one plugin that I would much like to use.

Piwigo 12.2.0
Operating system: Linux
PHP: 7.4.3 (Show info) [2022-03-27 06:16:10]
MySQL: 5.5.5-10.3.34-MariaDB-0ubuntu0.20.04.1 [2022-03-27 06:16:10]
Graphics Library: External ImageMagick 6.9.10-23
Cache size 45.99 Mo   calculated 1 day ago Refresh

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact