Follow us on Facebook and Twitter!

I am getting "invalid argument supplied for foreach()" warning
#1
Here is my situation.
I've integrated this wonderful module seamlessly on my local server.
When I moved it to the hosting site, I made a mistake and uploaded it into /commentics/upload/ folder. From there I did the install.
When I realized that this was not the place I wanted it to be, I moved all files (manually) to the /commentics/ folder. And I didn't do the new install.
Now things work seemingly OK, except that I am seeing a warning "invalid argument supplied for foreach() in /commentics/system/library/modification.php on line 32.
Even though it's just a warning I don't like it as it creates a new record every single time anyone accesses the frontend or the backend.
Might this error be related to me moving the files around manually? Can it be something in my server settings?
Anyone had a similar case?
Any ideas?
Thanks,
Mike
Reply
#2
Hi Mike,

Can you open /commentics/system/library/modification.php and above line 32 add:

PHP Code:
var_dump(CMTX_DIR_MOD_XML); 

That will show you the path it's trying to use.

If you only want it to show for you, you could wrap it in an IP address check like this:

PHP Code:
if ($_SERVER['REMOTE_ADDR'] == 'your_ip_address_here') {
var_dump(CMTX_DIR_MOD_XML);


If the path looks fine and it exists, can you try replacing:

PHP Code:
foreach (glob(CMTX_DIR_MOD_XML '*.xml') as $filename) {
$xmls[] = file_get_contents($filename);


With this:

PHP Code:
$glob_files glob(CMTX_DIR_MOD_XML '*.xml');
if (
is_array($glob_files) && count($glob_files) > 0) {
foreach (
$glob_files as $filename) {
$xmls[] = file_get_contents($filename);
}


If you could let me know the outcome that'd be great.
Have you completed the interview?
Reply
#3
Did both of the things you've suggested, Steven.
The error is gone!
Thanks a lot!
Mike
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  invalid video goppss 2 1,956 06-Jan-2013, 11:26 PM
Last Post: goppss
Exclamation Invalid XHTML 1.0 Transitional HTML code MFlame 6 2,834 08-Jun-2011, 01:52 AM
Last Post: MFlame

Forum Jump:


Users browsing this thread: 1 Guest(s)