Piwigo / piwigo-openstreetmap

OpenStreetMap integration for Piwigo
http://piwigo.org/ext/extension_view.php?eid=701
GNU General Public License v3.0
37 stars 35 forks source link

Pictures without GPS-information => PHP-8.0-warning #229

Closed 1e-9 closed 1 year ago

1e-9 commented 1 year ago

Pictures without GPS-information produce the following output when PHP 8.0 is activted:

Warning: Undefined array key "OSMJS" in /mnt/web115/a1/12/5421712/htdocs/piwigo/_data/templates_c/ljbwkp_bvtu6z^fd619a386ec1e7d13faef95df7bba10d138ce7b7_0.file.picture.tpl.php on line 327 Warning: Attempt to read property "value" on null in /mnt/web115/a1/12/5421712/htdocs/piwigo/_data/templates_c/ljbwkp_bvtu6z^fd619a386ec1e7d13faef95df7bba10d138ce7b7_0.file.picture.tpl.php on line 327

The named file contains this code from line 326:

if ($_smarty_tpl->tpl_vars['display_info']->value['rating_score'] && (isset($_smarty_tpl->tpl_vars['rate_summary']->value))) { if ($_smarty_tpl->tpl_vars['OSMJS']->value) {?>

<dt <?php echo $_smarty_tpl->tpl_vars['OSMNAMECSS']->value;?>

<?php echo $_smarty_tpl->tpl_vars['OSMNAME']->value;?>

<?php echo '<script'; ?> type="text/javascript"><?php echo $_smarty_tpl->tpl_vars['OSMJS']->value; echo '</script'; ?>

tpl_vars['SHOWOSM']->value) {?>
tpl_vars['rate_summary']->value['count']) {?>tpl_vars['rate_summary']->value['score'];?> (tpl_vars['rate_summary']->value['count']);?> )
1e-9 commented 1 year ago

The code snippet is displayed incorrectly. Next try: 2023-01-21 21_53_54-piwigo

IngeWolters commented 1 year ago

I got the same bug in the information/details tab. I found it annoying so I started searching for the bug:

In the file picture.inc.php, line 63, it says

{if $OSMJS}

If you replace it with

{if isset($OSMJS)}

the error will go away and you'll not see a map if there is no data available, instead of the error. You can change it yourself (purge your compiled templates if you do). I have not searched for any other ifs, that might give the same problem, as I only use the map on the information/details tab...

4ndreasH commented 1 year ago

same here: Piwigo 13.8.0, PHP 8.1.21