Report any technical problems you discover and discuss solutions.

v3: plugins.php error

  • jayaich
  • Onderwerp Auteur
  • Offline
  • Premium lid
  • Premium lid
Meer
10 jaren 11 maanden geleden #2964 door jayaich
v3: plugins.php error werd gestart door jayaich
Hi,

We seem to be getting a lot of array_merge errors being logged from the plugins.php file:
===============
[Fri Aug 07 15:48:47.939843 2015] [:error] [pid 9211] [client 141.163.50.11:45982] PHP Warning: array_merge(): Argument #1 is not an array in /var/www/html/xerte/plugins.php on line 46
[Fri Aug 07 15:48:47.939895 2015] [:error] [pid 9211] [client 141.163.50.11:45982] PHP Warning: Invalid argument supplied for foreach() in /var/www/html/xerte/plugins.php on line 48
===============

It seems that the arrays for the array merge are not checked for 'false' values, and if that occurs then a null array is not used instead. A quick patch is:
Code:
--- plugins.php.orig 2015-07-29 23:17:23.000000000 +0100 +++ plugins.php 2015-08-07 16:32:39.358388665 +0100 @@ -41,8 +41,10 @@ * Only looks in PLUGINS_PATH and one dir underneath. * Only loads files ending in .php */ -$files1 = glob(PLUGINS_PATH . D_S . '**' . D_S . '*.php'); +$files1 = glob(PLUGINS_PATH . D_S . '*' . D_S . '*.php'); +if ($files1 === false) $files1 = array(); $files2 = glob(PLUGINS_PATH . D_S . '*.php'); +if ($files2 === false) $files2 = array(); $files = array_merge($files1, $files2); foreach ($files as $file) {

I also changed the '**' to a single asterisk for files1. Not sure why '**' was used.


John.
De volgende gebruiker (s) zei dank u: JohnSmith

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Meer
10 jaren 11 maanden geleden #2965 door JohnSmith
Beantwoord door JohnSmith in topic v3: plugins.php error
Thanks John, I'll look into the errors and merge your changes in.

Graag Inloggen of een account aanmaken deelnemen aan het gesprek.

Moderators: ronmjultenJohnSmith
Tijd voor maken pagina: 0.128 seconden
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo