News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

PHP Undefined Index Notices in Subs-Post.php

Started by sah62, January 23, 2014, 08:37:00 AM

Previous topic - Next topic

sah62

This is on a server running 2.0.7. I'm seeing a couple of PHP error notices in a file named php_errors.log in my forum's home directory:


[22-Jan-2014 23:04:19 UTC] PHP Notice:  Undefined index: server in /public_html/forum/Sources/Subs-Post.php on line 622
[22-Jan-2014 23:04:19 UTC] PHP Notice:  Undefined index: character_set in /public_html/forum/Sources/Subs-Post.php on line 1229
[22-Jan-2014 23:04:19 UTC] PHP Notice:  Undefined index: character_set in /public_html/forum/Sources/Subs-Post.php on line 1229
[22-Jan-2014 23:04:19 UTC] PHP Notice:  Undefined index: character_set in /public_html/forum/Sources/Subs-Post.php on line 1229
[22-Jan-2014 23:04:19 UTC] PHP Notice:  Undefined index: utf8 in /public_html/forum/Sources/Subs-Post.php on line 1272
[22-Jan-2014 23:04:19 UTC] PHP Notice:  Undefined index: utf8 in /public_html/forum/Sources/Subs-Post.php on line 1274
[22-Jan-2014 23:04:19 UTC] PHP Notice:  Undefined index: character_set in /public_html/forum/Sources/Subs-Post.php on line 1229



Line 622: $line_break = $context['server']['is_windows'] || !$use_sendmail ? "\r\n" : "\n";

Line 1229: $charset = $custom_charset !== null ? $custom_charset : $context['character_set'];

Line 1272: if ($hotmail_fix && ($context['utf8'] || function_exists('iconv') || $context['character_set'] === 'ISO-8859-1'))

Line 1274: if (!$context['utf8'] && function_exists('iconv'))


I don't think these have anything to do with an upgrade from 2.0.6 to 2.0.7 because I saw the same notices prior to the upgrade. Does anyone have any thoughts on the cause or how I might be able to debug further?

sah62

I think I found the relevant HTTP GET in my server log:


X.X.X.X - - [22/Jan/2014:18:04:19 -0500] "GET /forum/index.php?scheduled=task;ts=1390431600 HTTP/1.1" 200 54 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"


The source IP address (obfuscated above) isn't my local host.

margarett

There are quite a few topic on this issue...

What language are you using?
Or, as per http://www.simplemachines.org/community/index.php?topic=505650.0
Quote
The "fix"

Check all files for added space/line before <? and ?> then delete them. Also for anything that should not be entered immediately after the beginning <?

What MODs do you have?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sah62

Quote from: margarett on January 23, 2014, 09:13:38 AM
There are quite a few topic on this issue...

What language are you using?

Default language is English. Thanks for the link. I did a search prior to posting and didn't find that topic in the returned results. I'm in the process of looking through the source files.

Quote
What MODs do you have?

AjaxChat_Integration_3.3b.zip
auto_purge_1.3.zip
feedIcon.zip
keycaptcha-for-smf.tar.gz
MessagePreviewOnHover.zip
No_Re_Emails_v1.3.8.tgz
PM_Status_v1_0.zip
show_in_topic_view_1.0.zip
SimpleAudioVideoEmbedder2.4.zip
smf_patch_1.1.19_2.0.6.tar.gz
smf_patch_2.0.1.tar.gz
smf_patch_2.0.2.tar.gz
smf_patch_2.0.3.tar.gz
smf_patch_2.0.4.tar.gz
smf_patch_2.0.5.tar.gz
smf_patch_2.0.7.tar.gz

margarett

Someone also suggested that this might be related to sendmail function and, as such, some issue in your server configuration...

Can you trace this issue up to a point in time? (meaning: when was this first logged?) Did you do any changes to your forum (other than 2.0.7) lately or did your host maybe moved your account to a new server?

There are a lot of topics about this issue but, apart from the one I linked you to, none has a *final* solution to this issue...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sah62

I haven't made any other recent changes and unfortunately I don't have a record of when the errors first started to appear. I moved to Linode server about 10 months ago and it's certainly possible that something changed during the move. Email seems to be working normally other than reports of people not receiving paid subscription reminder notices. There are no issues with topic reply notices etc.

margarett

Can you expand that log a bit more? Like including more lines?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sah62

Here's a bit more:


X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/ HTTP/1.1" 200 8570 "http://www.myserver.org/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/css/index.css?fin20 HTTP/1.1" 200 12540 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/scripts/script.js?fin20 HTTP/1.1" 200 13078 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/upshrink.png HTTP/1.1" 200 638 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/scripts/theme.js?fin20 HTTP/1.1" 200 1429 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/index.php?action=dlattach;attach=2645;type=avatar HTTP/1.1" 200 9701 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/collapse.gif HTTP/1.1" 200 207 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/scripts/fader.js HTTP/1.1" 200 2222 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/on.png HTTP/1.1" 200 1095 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/rss.png HTTP/1.1" 200 552 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/off.png HTTP/1.1" 200 780 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/upshrink2.png HTTP/1.1" 200 639 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/theme/submit_bg.png HTTP/1.1" 200 487 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/theme/backdrop.png HTTP/1.1" 200 370 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/theme/frame_repeat.png HTTP/1.1" 200 113 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/theme/menu_gfx.png HTTP/1.1" 200 2073 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/expand.gif HTTP/1.1" 200 224 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/new_some.png HTTP/1.1" 200 626 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/theme/main_block.png HTTP/1.1" 200 18028 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/new_none.png HTTP/1.1" 200 714 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/new_redirect.png HTTP/1.1" 200 556 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/post/xx.gif HTTP/1.1" 200 270 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:18 -0500] "GET /forum/Themes/default/images/icons/info.gif HTTP/1.1" 200 177 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:19 -0500] "GET /forum/Themes/default/images/icons/online.gif HTTP/1.1" 200 295 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:19 -0500] "GET /forum/index.php?scheduled=task;ts=1390431600 HTTP/1.1" 200 54 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:20 -0500] "GET /forum/index.php?action=unread HTTP/1.1" 200 4599 "http://www.myserver.org/forum/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/topic/my_hot_post.gif HTTP/1.1" 200 409 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/sort_down.gif HTTP/1.1" 200 73 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/icons/last_post.gif HTTP/1.1" 200 327 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/english/new.gif HTTP/1.1" 200 146 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/topic/normal_post.gif HTTP/1.1" 200 362 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/post/clip.gif HTTP/1.1" 200 875 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/topic/my_normal_post.gif HTTP/1.1" 200 384 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/topic/veryhot_post.gif HTTP/1.1" 200 387 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/topic/normal_poll.gif HTTP/1.1" 200 364 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/icons/quick_sticky.gif HTTP/1.1" 200 112 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/icons/quick_lock.gif HTTP/1.1" 200 212 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:21 -0500] "GET /forum/Themes/default/images/topic/hot_post.gif HTTP/1.1" 200 382 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"
X.X.X.X - - [22/Jan/2014:18:04:22 -0500] "GET /forum/index.php?topic=20934.0;topicseen HTTP/1.1" 200 6574 "http://www.myserver.org/forum/index.php?action=unread" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"

margarett

No, those are "general" requests.

Get the ones you first shown and "enlarge" a bit before and after, so that we see if there are other associated errors.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sah62

I found a small number of php source files that have a LF character (0x0A) after the closing ?>. Should those characters be removed? I'm not getting any "Cannot modify header information" errors.

The error log file I mentioned above is complete. it doesn't contain any other lines.

margarett

There are not PHP notices there ??? Did the issue disappeared by itself? :o

A LF should not cause issues but, in any case, nuke them :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sah62

Quote from: margarett on January 23, 2014, 11:46:24 AM
There are not PHP notices there ??? Did the issue disappeared by itself? :o

A LF should not cause issues but, in any case, nuke them :P

The errors I listed in the OP are the only lines in the php_errors.log file. There's nothing else there.

hadesflames

Are you on shared hosting, or a VPS/dedicated server? If VPS/dedicated, what operating system?

Arantor

Well, the errors in question are from the mail sending subroutine, from variables it's expecting to find in $context, but for some reason the scheduled tasks doesn't seem to set them up (which is doubly weird because it seems like it should fail every time)

sah62

Quote from: hadesflames on January 23, 2014, 12:14:17 PM
Are you on shared hosting, or a VPS/dedicated server? If VPS/dedicated, what operating system?

Linode VPS server running Ubuntu 12.04 LTS. My web server is nginx/1.1.19, PHP version is 5.3.10-1ubuntu3.9.

sah62

Quote from: Sir Cumber-Patcher on January 23, 2014, 12:19:33 PM
Well, the errors in question are from the mail sending subroutine, from variables it's expecting to find in $context, but for some reason the scheduled tasks doesn't seem to set them up (which is doubly weird because it seems like it should fail every time)

This is interesting. In one of my posts above I noted that I've had users tell me that they didn't receive a paid subscription reminder email, which should be sent when a scheduled task runs. The appropriate task is definitely set to run, and the task log shows that it does. Could there be a permissions issue somewhere that's causing something to fail silently?

Arantor

No...

The code path actually looks wrong... the relevant entry in your access log shows quite clearly that a scheduled task was run, scheduled tasks do often call sendmail() which is where your errors came from. But sendmail() relies on $context['server'] and other things, that are not loaded from loadEssentialThemeData() while they are in loadTheme().

As I'm looking over it, it should never have worked properly but yet it does because we don't see a flood of errors here for example...

sah62

For whatever it's worth the task that started things moving here was the "Send Birthday Emails" task. When I run it manually there are no errors. I'll see what happens when it next runs automatically.

sah62

The errors occurred again when the "Send Birthday Emails" task ran automatically. Here's what was captured in php_errors.log:


[23-Jan-2014 23:00:52 UTC] PHP Notice:  Undefined index: server in /public_html/forum/Sources/Subs-Post.php on line 622
[23-Jan-2014 23:00:52 UTC] PHP Notice:  Undefined index: character_set in /public_html/forum/Sources/Subs-Post.php on line 1229
[23-Jan-2014 23:00:52 UTC] PHP Notice:  Undefined index: character_set in /public_html/forum/Sources/Subs-Post.php on line 1229
[23-Jan-2014 23:00:52 UTC] PHP Notice:  Undefined index: character_set in /public_html/forum/Sources/Subs-Post.php on line 1229
[23-Jan-2014 23:00:52 UTC] PHP Notice:  Undefined index: utf8 in /public_html/forum/Sources/Subs-Post.php on line 1272
[23-Jan-2014 23:00:52 UTC] PHP Notice:  Undefined index: utf8 in /public_html/forum/Sources/Subs-Post.php on line 1274
[23-Jan-2014 23:00:52 UTC] PHP Notice:  Undefined index: character_set in /public_html/forum/Sources/Subs-Post.php on line 1229


I made sure that my birthday was scheduled for today. There are no errors in the forum logs, but I did get two copies of the "Happy birthday" email. The first was sent when the task ran automatically. The second was sent when I ran the task manually after it ran automatically - and when I ran it manually no errors were produced.

Advertisement: