[drupal-devel] [bug] make sure links are an array

danielc drupal-devel at drupal.org
Fri Apr 8 23:12:16 UTC 2005


Issue status update for http://drupal.org/node/18835

 Project:      Drupal
 Version:      cvs
 Component:    theme system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Olen
 Updated by:   danielc
 Status:       patch

Uwe makes a very good point.


danielc



Previous comments:
------------------------------------------------------------------------

March 13, 2005 - 08:55 : Olen

Had a bug in some module where theme_links was called but '$links' was
not an array.
Ofcourse the real bug was in the module, but I theme_links should maybe
not produce ugly errors if this happens?
--- theme.inc.orig      2005-03-13 14:51:45.829133700 +0100
+++ theme.inc   2005-03-13 14:46:55.000000000 +0100
@@ -432,7 +432,9 @@
  *   A string containing the themed links.
  */
 function theme_links($links, $delimiter = ' | ') {
-  return implode($delimiter, $links);
+  if (is_array($links)) {
+    return implode($delimiter, $links);
+  }
 }
 /**



------------------------------------------------------------------------

April 8, 2005 - 03:16 : chx

I do not think it is the task of core to correct the incorrect work of
non-core modules.


------------------------------------------------------------------------

April 8, 2005 - 17:54 : Uwe Hermann

IMHO core should be programmed defensively and robust, and not fail on
errors which it could detect and react upon properly.





More information about the drupal-devel mailing list