News:

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

Main Menu

Looking for how to define an index when it isn't defined.

Started by richardwbb, December 07, 2016, 12:49:47 PM

Previous topic - Next topic

richardwbb

If I am posting in the wrong board, please say so. Thank you.

I've seen a couple of things, latin, utf, 'hotmail conversion', 'smtp', and 'if exist, iconv' so that has to do with the language template.

I also read that the undefined utf8 index will be fixed in 2.1, though I would like to learn; how to define an index.

The plugin that is doing this is; http://custom.simplemachines.org/mods/index.php?mod=2607 and it seems to me by looking in to install.php and from there; GuestRegistrationNotification.php this plugin can't help this.

I took some steps to reproduce, and besided on learning how to define an index, I also tell all of you, it is better for me to ask about something that I understand partial, then asking question about things that seem more like magic to me then anything else.

The error's in logfile are;

Quote
[Wed Dec 07 17:39:13.109025 2016] [:error] [pid 2315] [client 127.0.0.1:51000] PHP Notice:  Undefined index: server in /media/sda6/[data]/html/smf/Sources/Subs-Post.php on line 686, referer: http://localhost/smf/index.php
[Wed Dec 07 17:39:13.109170 2016] [:error] [pid 2315] [client 127.0.0.1:51000] PHP Notice:  Undefined index: utf8 in /media/sda6/[data]/html/smf/Sources/Subs-Post.php on line 1332, referer: http://localhost/smf/index.php
[Wed Dec 07 17:39:13.109180 2016] [:error] [pid 2315] [client 127.0.0.1:51000] PHP Notice:  Undefined index: utf8 in /media/sda6/[data]/html/smf/Sources/Subs-Post.php on line 1334, referer: http://localhost/smf/index.php

The code [Sources/Subs-Post.php];

line 686;
// Line breaks need to be \r\n only in windows or for SMTP.
$line_break = $context['server']['is_windows'] || !$use_sendmail ? "\r\n" : "\n";

line 1332;
// Convert all special characters to HTML entities...just for Hotmail :-\
if ($hotmail_fix && ($context['utf8'] || function_exists('iconv') || $context['character_set'] === 'ISO-8859-1'))
{
if (!$context['utf8'] && function_exists('iconv'))
{
$newstring = @iconv($context['character_set'], 'UTF-8', $string);
if ($newstring)
$string = $newstring;
}

line 1334;
'if (!$context['utf8'] && function_exists('iconv'))'

If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

Illori

if that error was so easy to just "define" to fix, we would have already. that error has been reported before with no real solution available.

richardwbb

Quote from: Illori on December 07, 2016, 12:52:17 PM
if that error was so easy to just "define" to fix, we would have already. that error has been reported before with no real solution available.

Oh.  :D

So it it defined somewhere and PHP just didn't got it, maybe? Could it be session_start related? I started to write the content of PHP_SELF to text-file from SMF index.php, it turned out it wouldn't accept multple <?php [here some code like declaring a variable] ?> <?php [here some code like putting contents of variable to file with 'file_put_contents'] ?>

And that worked apparently, only a week later I noticed 'Insert Quote' disfunctional [and Quote was working], then I updated my [old] theme's javascript, didn't help. Then I swapped Sources, Themes, etc, for untouched install of SMF, didn't help.

Then I changed the  <?php [here some code like declaring a variable] ?> <?php [here some code like putting contents of variable to file with 'file_put_contents'] ?> to;

<?php [here some code like declaring a variable] ; [here some code like putting contents of variable to file with 'file_put_contents'] ?>

And now 'Insert Quote' is working fine. B.t.w, js script nice in 2.1..
If my post in this topic looks ambiguous to you, then I'm with Murphy's law and General Stupidity. In other words, trial and error.

Advertisement: