On every page on one of my sites every page has the followings:
* warning: Invalid argument supplied for foreach() in /home3/jennifm8/public_html/includes/theme.inc on line 463.
* warning: Invalid argument supplied for foreach() in /home3/jennifm8/public_html/includes/theme.inc on line 468.
Right after I change the them it repeats the above message three times.
I have multiple sites using the same theme and base installation directory only using different config files in the sites folder and only one of the sites has this issue. The only site that was affected as the site configured under the sites/default directory but I've since changed that site to it's own config directory. An example of a working site is http://evertechconsulting.com and the broken one is http://everettpilling.com and they had identical modules active.
I have tried many different things to rectify this issue. I started having this issue in version 6.11 and have since upgraded to 6.12 and now to 6.13 hoping it would fix the issue but to no avail. Looking and deleting hidden .files, changing the directory of the custom themes, looking for and removing non-ASCII characters in theme and settings files, changing themes, purging caches, etc and nothing seems to fix it.
This issue shows up regardless of the theme selected on only that one site [everettpilling.com] but none of the other sites sharing the same installation are affected.
Trying to find out solutions I have searched Google with the following query:
"warning: Invalid argument supplied for foreach()" "includes/theme.inc on line 463"
and found primarily that scores of other sites where having this issue.
The thought came to me that a hacker has done something to embed code into the MySQL database as I have completely changed out all of the PHP scripts and None of the other sites were affected. I don't know enough to dig around my database and so I need help getting this resolved and apparently hundreds of other Drupal users as well.
Please help!
Comments
Comment #1
turco commentedI have experienced the same issue on the line 1154, and it is only with some Themes, not all themes. As an example: problem with Sky, but no problem with Marinelli. I use VirtualSite for multiple sites, I guess it is about that but I am not sure yet. I need help now too.
Comment #2
cach commentedI have the same problem with no luck solving it.
Comment #3
cach commentedSolution
The file theme_name.info - I took away all special characters and saved the file in UTF-8 and this solved the problem.
Comment #4
chrissommers commentedThanks for the tip, it really helped. I did my prototype under Windows and had edited some .css files etc. for my custom theme based on Garland. After uploading it to a Linux hosting server it gave similar error messages. I copied the suspect files from my Windows machine onto an Ubuntu Linux machine. I wrote a script (below) which I ran to make the relevant files under sites/ Linux-compatible. Those files were my custom theme files under sites/all/themes as well as the color-adjusted files under sites/default/files/color.
The script below relies on the "fromdos" utility which takes a file, converts windows/dos line endings into Linux line endings. If you have an Ubuntu machine you can install fromdos using the command "sudo apt-get install fromdos." The script below goes recursively through the directory specified by the first argument (or . by default) and runs all files with the specified extensions through the fromdos utility. These are all the text-type files I could identify. Don't try this on binary files, it might wreck them. Make a backup of your files before you run this in case you need to revert. I did this on the aforementioned directories and copied them over the server files and all the trouble disappeared.
Here is the script:
-----------------------------------
#!/bin/sh
#
# force all files to linux end of line format
#
if [ $# -lt 1 ]; then
dir="."
else
dir=$1
fi
for ext in css txt html php tpl info htaccess sh js module install inf ini
do
echo "$0 Processing .$ext in $dir"
find $dir -name *.$ext | xargs fromdos -f -v -l fromdos.log
done
--------------------
How to use (if you're not familiar with Linux):
1. Copy the script into a file (I called mine fromdosall.sh).
2. Make the file executable: chmod +x fromdosall.sh
3. Execute the script for each directory you need to fix. When you execute it you have to have the path to the script or the operating system won't find it. The easiest thing is to just copy it to the sites/ directory.
4. The script keeps a log of its activity in fromdos.log which you can read if you need to.
Here is an example of executing it (assume script is in sites/):
./fromdosall.sh all/themes/mythemedirectory
Comment #5
dpearcefl commentedIs this still an active issue?
Comment #6
dpearcefl commented