Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
Report any technical problems you discover and discuss solutions.
  • Page:
  • 1

TOPIC:

v3: plugins.php error 8 years 8 months ago #2964

  • jayaich
  • jayaich's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 92
  • Thank you received: 5
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:
--- 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.
The following user(s) said Thank You: JohnSmith

Please Log in or Create an account to join the conversation.

v3: plugins.php error 8 years 8 months ago #2965

  • JohnSmith
  • JohnSmith's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 397
  • Thank you received: 71
Thanks John, I'll look into the errors and merge your changes in.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ronmjultenJohnSmith
Time to create page: 0.042 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search