Admin comments page: An Error Has Occurred #2234

Open
opened 2026-10-05 01:10:36 +02:00 by adam · 3 comments
Owner

Piwigo 16.4.0
Installed on 1 January 2018, 8 years 8 months 1 week 2 days ago
Operating system: Linux
PHP: 8.4.24
MySQL: 11.8.6-MariaDB-0+deb13u1 from Debian [2026-09-11 06:02:41]
Graphics Library: External ImageMagick 7.1.1-43

When opening the Admin "Comments" page, no comments are displayed an an "An error has occurred" popup window is diplayed instead.

Inspecting in a web browser, the "ws.php" return:

<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br />
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br />
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br />
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br />
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br />
{"stat":"ok","result":{"summary":{"all_comments":"24","validated":"24","pending":"0"},"comments":[{"id":"10"," ...

This can be fixed by replacing null strings with empty string immediately before making the function call on line 214:

      // Convert null arguments to empty strings to protect strict native string functions like strip_tags
      $args = array_map(function($arg) {
          return is_null($arg) ? '' : $arg; 
      }, $args);
      $data = call_user_func_array($handler['function'], $args);

There is probably a better way to fix this.

[Piwigo](https://piwigo.org/) 16.4.0 Installed on 1 January 2018, 8 years 8 months 1 week 2 days ago Operating system: Linux PHP: 8.4.24 MySQL: 11.8.6-MariaDB-0+deb13u1 from Debian [2026-09-11 06:02:41] Graphics Library: External ImageMagick 7.1.1-43 When opening the Admin "Comments" page, no comments are displayed an an "An error has occurred" popup window is diplayed instead. Inspecting in a web browser, the "ws.php" return: ```html <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br /> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br /> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br /> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br /> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>214</b><br /> {"stat":"ok","result":{"summary":{"all_comments":"24","validated":"24","pending":"0"},"comments":[{"id":"10"," ... ``` This can be fixed by replacing null strings with empty string immediately before making the function call on line 214: ```php // Convert null arguments to empty strings to protect strict native string functions like strip_tags $args = array_map(function($arg) { return is_null($arg) ? '' : $arg; }, $args); $data = call_user_func_array($handler['function'], $args); ``` There is probably a better way to fix this. <!-- github-sync-id:5420230899 -->
Author
Owner

hi
which plugins activated ? i try reproduce this

hi which plugins activated ? i try reproduce this <!-- github-comment-id:5634043241 -->
Author
Owner

try desactve all plugins

try desactve all plugins <!-- github-comment-id:5634386629 -->
Author
Owner
Activated plugin list 15

    Admin Tools
    Check Uploads
    Comments on Albums
    Community
    Extended Description
    Language Switch
    Ldap_Login
    LocalFiles Editor
    OpenStreetMap
    Physical Photo Move
    PWG Stuffs
    Rotate Image
    Take A Tour of Your Piwigo
    Theme Switch
    User Tags

(I had already tried deactivating the "Comments on Albums" plugin to no avail)

It is because the "author" field in some comments is emtpy. I added some debug output:

<!-- EXECUTING: osm_ws_images_setInfo -->
<!-- EXECUTING: ws_isInvokeAllowed -->
<!-- EXECUTING: strip_tags -->
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br />
<!-- EXECUTING: render_comment_content -->
<!-- EXECUTING: strip_tags -->
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br />
<!-- EXECUTING: render_comment_content -->
<!-- EXECUTING: strip_tags -->
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br />
<!-- EXECUTING: render_comment_content -->
<!-- EXECUTING: strip_tags -->
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br />
<!-- EXECUTING: render_comment_content -->
<!-- EXECUTING: strip_tags -->
<br />
<b>Deprecated</b>:  strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br />
<!-- EXECUTING: render_comment_content -->
{"stat":"ok","result":{"summary":{"all_comments":"24"

The following calls to "render_comment_content" exist:

root@boa:/etc/piwigo# find /opt/piwigo/ -name "*.php" -exec grep -H "render_comment_content" {} \;
/opt/piwigo/tools/triggers_list.php:  'name' => 'render_comment_content',
/opt/piwigo/piwigo/tools/triggers_list.php:  'name' => 'render_comment_content',
/opt/piwigo/piwigo/admin/comments.php:      'CONTENT' => trigger_change('render_comment_content',$row['content']),
/opt/piwigo/piwigo/include/picture_comment.inc.php:          'CONTENT' => trigger_change('render_comment_content',$row['content']),
/opt/piwigo/piwigo/include/functions_html.inc.php:function render_comment_content($content)
/opt/piwigo/piwigo/include/common.inc.php:add_event_handler('render_comment_content', 'render_comment_content');
/opt/piwigo/piwigo/comments.php:      'CONTENT'=>trigger_change('render_comment_content',$comment['content']),
/opt/piwigo/include/picture_comment.inc.php:          'CONTENT' => trigger_change('render_comment_content',$row['content']),
/opt/piwigo/include/functions_html.inc.php:function render_comment_content($content)
/opt/piwigo/include/common.inc.php:add_event_handler('render_comment_content', 'render_comment_content');
/opt/piwigo/include/ws_functions/pwg.comments.php:      'content' => trigger_change('render_comment_content', $row['content']),
/opt/piwigo/comments.php:      'CONTENT'=>trigger_change('render_comment_content',$comment['content']),
/opt/piwigo/plugins/Comments_on_Albums/stuffs_module/main.inc.php:      'CONTENT'=> trigger_change('render_comment_content',$comment['content'], 'album'),
/opt/piwigo/plugins/Comments_on_Albums/include/coa_comments_page.php:      'CONTENT' => trigger_change('render_comment_content', $comment['content'], 'album'),
/opt/piwigo/plugins/Comments_on_Albums/include/coa_albums.php:        'CONTENT' => trigger_change('render_comment_content', $row['content'], 'album'),
/opt/piwigo/plugins/Comments_on_Albums/admin.php:      'CONTENT' => trigger_change('render_comment_content', $row['content'], 'album'),
/opt/piwigo/plugins/PWG_Stuffs/modules/LastComs/main.inc.php:      'CONTENT' => trigger_change('render_comment_content',$comment['content']),

I disabled all plugins and I still get the error.

/etc/php/8.4/apache2/php.ini:error_reporting = E_ALL & ~E_DEPRECATED

/opt/piwigo/local/config/config.inc.php://$conf['show_php_errors'] = E_ALL;
/opt/piwigo/local/config/config.inc.php:$conf['show_php_errors'] = '';
/opt/piwigo/local/config/config.inc.php:$conf['show_php_errors_on_frontend'] = false;
/etc/piwigo/config.inc.php://$conf['show_php_errors'] = E_ALL;
/etc/piwigo/config.inc.php:$conf['show_php_errors'] = '';
/etc/piwigo/config.inc.php:$conf['show_php_errors_on_frontend'] = false;
``` Activated plugin list 15 Admin Tools Check Uploads Comments on Albums Community Extended Description Language Switch Ldap_Login LocalFiles Editor OpenStreetMap Physical Photo Move PWG Stuffs Rotate Image Take A Tour of Your Piwigo Theme Switch User Tags ``` (I had already tried deactivating the "Comments on Albums" plugin to no avail) It is because the "author" field in some comments is emtpy. I added some debug output: ```html <!-- EXECUTING: osm_ws_images_setInfo --> <!-- EXECUTING: ws_isInvokeAllowed --> <!-- EXECUTING: strip_tags --> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br /> <!-- EXECUTING: render_comment_content --> <!-- EXECUTING: strip_tags --> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br /> <!-- EXECUTING: render_comment_content --> <!-- EXECUTING: strip_tags --> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br /> <!-- EXECUTING: render_comment_content --> <!-- EXECUTING: strip_tags --> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br /> <!-- EXECUTING: render_comment_content --> <!-- EXECUTING: strip_tags --> <br /> <b>Deprecated</b>: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/opt/piwigo/include/functions_plugins.inc.php</b> on line <b>219</b><br /> <!-- EXECUTING: render_comment_content --> {"stat":"ok","result":{"summary":{"all_comments":"24" ``` The following calls to "render_comment_content" exist: ```bash root@boa:/etc/piwigo# find /opt/piwigo/ -name "*.php" -exec grep -H "render_comment_content" {} \; /opt/piwigo/tools/triggers_list.php: 'name' => 'render_comment_content', /opt/piwigo/piwigo/tools/triggers_list.php: 'name' => 'render_comment_content', /opt/piwigo/piwigo/admin/comments.php: 'CONTENT' => trigger_change('render_comment_content',$row['content']), /opt/piwigo/piwigo/include/picture_comment.inc.php: 'CONTENT' => trigger_change('render_comment_content',$row['content']), /opt/piwigo/piwigo/include/functions_html.inc.php:function render_comment_content($content) /opt/piwigo/piwigo/include/common.inc.php:add_event_handler('render_comment_content', 'render_comment_content'); /opt/piwigo/piwigo/comments.php: 'CONTENT'=>trigger_change('render_comment_content',$comment['content']), /opt/piwigo/include/picture_comment.inc.php: 'CONTENT' => trigger_change('render_comment_content',$row['content']), /opt/piwigo/include/functions_html.inc.php:function render_comment_content($content) /opt/piwigo/include/common.inc.php:add_event_handler('render_comment_content', 'render_comment_content'); /opt/piwigo/include/ws_functions/pwg.comments.php: 'content' => trigger_change('render_comment_content', $row['content']), /opt/piwigo/comments.php: 'CONTENT'=>trigger_change('render_comment_content',$comment['content']), /opt/piwigo/plugins/Comments_on_Albums/stuffs_module/main.inc.php: 'CONTENT'=> trigger_change('render_comment_content',$comment['content'], 'album'), /opt/piwigo/plugins/Comments_on_Albums/include/coa_comments_page.php: 'CONTENT' => trigger_change('render_comment_content', $comment['content'], 'album'), /opt/piwigo/plugins/Comments_on_Albums/include/coa_albums.php: 'CONTENT' => trigger_change('render_comment_content', $row['content'], 'album'), /opt/piwigo/plugins/Comments_on_Albums/admin.php: 'CONTENT' => trigger_change('render_comment_content', $row['content'], 'album'), /opt/piwigo/plugins/PWG_Stuffs/modules/LastComs/main.inc.php: 'CONTENT' => trigger_change('render_comment_content',$comment['content']), ``` **I disabled all plugins and I still get the error.** `/etc/php/8.4/apache2/php.ini:error_reporting = E_ALL & ~E_DEPRECATED` ```php /opt/piwigo/local/config/config.inc.php://$conf['show_php_errors'] = E_ALL; /opt/piwigo/local/config/config.inc.php:$conf['show_php_errors'] = ''; /opt/piwigo/local/config/config.inc.php:$conf['show_php_errors_on_frontend'] = false; ``` ```php /etc/piwigo/config.inc.php://$conf['show_php_errors'] = E_ALL; /etc/piwigo/config.inc.php:$conf['show_php_errors'] = ''; /etc/piwigo/config.inc.php:$conf['show_php_errors_on_frontend'] = false; ``` <!-- github-comment-id:5635096919 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#2234