Invalid argument supplied for foreach() - Posting Error

Started by Sudhakar Arjunan, August 01, 2008, 12:23:07 PM

Previous topic - Next topic

Sudhakar Arjunan

Am using SMF 1.1.5.

While Posting i have lot of errors like one shown below.

2: Invalid argument supplied for foreach()
File: /path/to/server/forum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 909

8: Undefined index: smiley_groups
File: /path/to/server/forum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 909

8: Undefined index: description
File: /path/to/server/forum/Sources/Subs-Post.php
Line: 1654

Could anyone help me to solve this issue.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

ccbtimewiz

What theme are you currently using?

Have you installed any modifications lately?

Sudhakar Arjunan

Am using Dilber MC Theme.

This problem was occuring for long day. But i dont remember the mod i have installed, even when i don't remember?.
The error shows Smiley . But no such Smiley named mod also.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

tatore

LoL,
You have more than 120 mods installed, but nothing related to smiley set, true  ;)
First off I'd suggest you to disable template eval, just to have the correct location/source of your errors.
Via phpMyAdmin (What's phpMyAdmin?) run the following queries:

INSERT INTO smf_settings VALUES ('disableTemplateEval', 1);

After that run again the other query as follows:

DELETE FROM smf_settings WHERE variable = 'disableTemplateEval'; This will re-enable the template eval, but meantime you'll have exactly what's really going on.
Then, paste here the reports of your error log.
*Salvo*




Quote from: RumbaarI wont jump to conclusion, but you might be hacked?

Sudhakar Arjunan

I have installed more than 250 - 280 mods .

Thanks for these code.

I will try what you have told me.

First will use the code to stop the eval function.

Then what i have to do to find the error notes. And will it be on the error log itself.

Then is that final command is used to reactivate eval . Is that right ?
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

tatore

You've been better and clearer than me!!
Perfect. Do that, copy the errors, re-enable template eval ;)
*Salvo*




Quote from: RumbaarI wont jump to conclusion, but you might be hacked?

Sudhakar Arjunan

#6
I have inserted the command.

Replying to one test post.

Hope i found no change in it.

Kindly check this out.

The_Big_S       Today at 01:27:41
Apply Filter: Only show the error messages of this IP address 100.124.161.00      Apply Filter: Only show the error messages of this session 31e8b96cf8e93d95e1525685be9b4778
Apply Filter: Only show the error messages of this URL http://forum.itacumens.com/index.php?action=post2
Apply Filter: Only show the errors with the same message
2: Invalid argument supplied for foreach()
File: /path/to/server/forum/Themes/default/Post.template.php
Line: 925
   
Apply Filter: Only show the error messages of this member The_Big_S    Today at 01:27:41
Apply Filter: Only show the error messages of this IP address 100.124.161.00      Apply Filter: Only show the error messages of this session 31e8b96cf8e93d95e1525685be9b4778
Apply Filter: Only show the error messages of this URL http://forum.itacumens.com/index.php?action=post2
Apply Filter: Only show the errors with the same message
8: Undefined index: smiley_groups
File: /path/to/server/forum/Themes/default/Post.template.php
Line: 925

Could i delete the command now. Have you got some idea from these errors.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

ccbtimewiz


tatore

Ok, now we know that the all errors are generated from /Themes/default/post.template.php-
Can you upload here your post.template.php file?

*Edit: the both errors from line 925
**Edit: re-enable template eval, please.
*Salvo*




Quote from: RumbaarI wont jump to conclusion, but you might be hacked?

Sudhakar Arjunan

Yes i have applied the second command in my phpadmin. I hope i mean re-enabled Template Eval.

Will attach the default/post.template.php page

I had looked at line no.925 and got these code.

                echo "\n";
                foreach ($context['smiley_groups'] as $smiley_group)
                {
                        echo 'smiley_group[';
                        echo $smiley_group['number'];
                        echo ']=[[';
                        $smiley_seperator = "";
                        foreach ($context['smileys']['hidden_group'] as $smiley_row)
                        {
                                foreach ($smiley_row['smileys'] as $smiley)
                                {
                                        if ($smiley['group'] == $smiley_group['number'])
                                        {
                                                echo $smiley_seperator, '[\'', $smiley['code'], '\',\'', $smiley['filename'],  '\',\'', $smiley['description'], '\']';
                                                $smiley_seperator = ",";
                                        }
                                }
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

tatore

Please, first off backup the existing one, and then replace that with this one attached.
Don't know why (maybe you know  :D ), there was a portion of code belonging to a mod. Smiley Pops.
Now it should be clear, since I did the reverse process (only a part of the code was present into your file) on that file.
Let me know.
*Salvo*




Quote from: RumbaarI wont jump to conclusion, but you might be hacked?

Sudhakar Arjunan

Yes i have compared the edited and old file.

you have completely removed the Smiley pops contents.

Removing will not give a problem is it.

Or did have to uninstall.

As far as now, i have replaced the edited files and its working good and no more errors.

But i am not sure whether this is a correct one or make cause some changes later for post.template page.

Thank you and leave the comments for reference. Whether to replace the old one or to have the new one.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

tatore

Well, if you've the mod installed you have to know that post.template.php file is missing some code to accomplish the mod's functions(even the uninstall process).
As you said above, if you didn't have any smiley mod installed, post.template.php parsed as I did is clean and will work.
You can check the modifications that Smiley Pops does here.
Eventually upload here the all files listed in the link, and I will compare them and undo the strings (if any is still elsewhere).
*Salvo*




Quote from: RumbaarI wont jump to conclusion, but you might be hacked?

Sudhakar Arjunan

Hi Tatore,

Thanks a lot for it.

Its has almost cleared some errors in my forum.

As you have Cleared the code. These errors were going.

And i have a error in Description Field also.

8: Undefined index: description
File: /home/itacumen/public_html/forum/Sources/Subs-Post.php
Line: 1654

Is these errors because of installing the mods even test failed . Is It ?
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

tatore

Hello, asudhakar.
Can I ask you to upload here the Subs-post file?
I'll un-do the modifications. ;)

*250 mods  :P
*Salvo*




Quote from: RumbaarI wont jump to conclusion, but you might be hacked?

Sudhakar Arjunan

I went Out.

Thanks for your help.

Dont remove it. Help to clear the error alone.

Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

tatore

Uhm..t comes from a mod:

Quote
Topic description|^|Topic_description_1.1.zip|^|rudolf:topicdescription|^|1.1
Check if in your forum/Themes/default/languages/index.english.php the following string is in there


$txt['topic_description'] = 'Description'; //-Topic description MOD-


And just tell me what about the test failed, wich files?
It's a really complex mod, since it affects many files and it could be a bit hard to find what's wrong.
Usually the undefined index come from a file.template.php, that invoke a text string missing, not from the ./source files folder.
Let try, by the way, to check first the index.english.php.
FYI this is the parser for that mod.
*Salvo*




Quote from: RumbaarI wont jump to conclusion, but you might be hacked?

Rumbaar

I would look to the author of the Smiley Pops mod.  I've seen a number of people have issue with this mod, and with those that have I've never been able to fix there issue.  This was even with less mods, and the number you have I'm sure will have a conflict with that mods coding.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Sudhakar Arjunan

Quote from: Rumbaar on August 06, 2008, 07:19:53 AM
I would look to the author of the Smiley Pops mod.  I've seen a number of people have issue with this mod, and with those that have I've never been able to fix there issue.  This was even with less mods, and the number you have I'm sure will have a conflict with that mods coding.

Thank you.

Still i have lots of errors generated.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

ccbtimewiz

Are you still getting these errors, sudhakar? Do you still require assistance in resolving them?

As Rumbaar said, I'd look to asking the mod author.

Advertisement: