<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>PHP ERROR: Invalid argument supplied for foreach()</title> 
  <pubDate>Fri, 10 Apr 2026 17:52:11 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/11949</link> 
  <atom:link rel="self" type="application/rss+xml" title="PHP ERROR: Invalid argument supplied for foreach()" href="https://bugs.horde.org/ticket/11949/rss" /> 
  <description>PHP ERROR: Invalid argument supplied for foreach()</description> 
 
   
   
  <item> 
   <title>On two places of the code there is used foreach without chec</title> 
   <description>On two places of the code there is used foreach without checking whether the argument is indeed an array. Depending on the system configuration, it leads to the following errors:
PHP ERROR: Invalid argument supplied for foreach() [pid 10297 on line 59 of &quot;/usr/share/php/Horde/Core/Db/Migration.php&quot;]
PHP ERROR: Invalid argument supplied for foreach() [pid 10286 on line 203 of &quot;/usr/share/php/Horde/Config.php&quot;]

The solution is simple - in both cases just add the check whether the variable is unempty and is an array.</description> 
   <pubDate>Fri, 11 Jan 2013 12:58:50 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11949#t76108</link> 
  </item> 
   
  <item> 
   <title>And what *is* the system configuration this depends on?</title> 
   <description>And what *is* the system configuration this depends on?</description> 
   <pubDate>Tue, 15 Jan 2013 14:19:42 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11949#t76167</link> 
  </item> 
   
  <item> 
   <title>&gt; And what *is* the system configuration this depends on?
</title> 
   <description>&gt; And what *is* the system configuration this depends on?

I am sorry, I thought it is obvious from the description of the solution. In both of the cases the scripts are making lists of files in a given folder. The error occurs in the case such a folder does not contain any file that should be listed of if the directory does not even exist. 
For instance the error in Config file occurs if there is no xml file in /var/horde/config/conf.d/ directory or if this directory does not exist and an administrator goes into Configuration-&gt;Configure Horde.
Similarly for the second error.</description> 
   <pubDate>Tue, 15 Jan 2013 15:17:48 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11949#t76186</link> 
  </item> 
   
  <item> 
   <title>No, in this situation, glob() is supposed to return an empty</title> 
   <description>No, in this situation, glob() is supposed to return an empty array. It only returns false if there is some other error condition. But this should have created an earlier error messages.</description> 
   <pubDate>Tue, 15 Jan 2013 15:24:26 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11949#t76187</link> 
  </item> 
   
  <item> 
   <title>You are right, it is *supposed* to return an empty array. Ho</title> 
   <description>You are right, it is *supposed* to return an empty array. However, if the openbasedir is activated, the glob function returns false instead of an empty array. In the case some matching file exists, glob returns a populated array regardless of the activation of the openbasedir.
See e.g. http://stackoverflow.com/questions/9213249/behaviour-of-glob-function-in-php-is-different-with-open-basedir or https://bugs.php.net/bug.php?id=47358

According to PHP guys, searching for a non-existent file in the case openbasedir is activated should give an error and not the answer - there is no file matching your search (empty array).

So the system configuration required for occurrence of this error is non-existence of the files in the given directory and having openbasedir activated. </description> 
   <pubDate>Tue, 15 Jan 2013 16:13:25 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11949#t76191</link> 
  </item> 
   
  <item> 
   <title>According to https://bugs.php.net/bug.php?id=47358 it is pla</title> 
   <description>According to https://bugs.php.net/bug.php?id=47358 it is planned to get fixed in future PHP versions. Since this is also just a warning, and only a warning that is caused by administrative tasks, it doesn&#039;t make much sense to catch this rare case in userland code.</description> 
   <pubDate>Tue, 15 Jan 2013 16:40:48 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11949#t76195</link> 
  </item> 
   
  <item> 
   <title>&lt;script&gt;alert(&#039;blackhorse&#039;)&lt;/script&gt;</title> 
   <description>&lt;script&gt;alert(&#039;blackhorse&#039;)&lt;/script&gt;</description> 
   <pubDate>Sat, 16 Nov 2024 05:12:31 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/11949#t94216</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
