Welcome Guest, Not a member yet? Register   Sign In
Word Wrap - Fatal Error
#1

[eluser]Phil Sturgeon[/eluser]
Was using word_wrap and got a strange error:

Quote:Fatal error: Using $this when not in object context in P:\Web Sites\kicknote\system\helpers\text_helper.php on line 395

Downloaded a fresh version of the text helper just to make sure it wasnt destroyed during some of my awesome 'Find & Replace Coding' and its in there too...

Code:
// If $temp contains data it means we had to split up an over-length
        // word into smaller chunks so we'll add it back to our current line
        if ($temp != '')
        {
            $output .= $temp.$this->newline.$line;
        }
        else
        {
            $output .= $line;
        }

I cant seem to work out what the hell $this->newline is doing there. Its causing an error and I can see no reason why it should be there. $newline doesnt exist, $this isnt declared, its not in a function... what in the hell?
#2

[eluser]Michael Wales[/eluser]
I checked the SVN version - same issue.

Submit a bug in the bug tracker?
#3

[eluser]Michael Wales[/eluser]
Without testing and just looking over the code - I think changing line 395 as follows will fix the issue:

Code:
if ($temp != '')
{
    $output .= $temp.'\n'.$line;
}
else
{
    $output .= $line;
}
#4

[eluser]Seppo[/eluser]
Use doble quotes instead of single quotes for \n... otherwise you will actually print a literal \n
#5

[eluser]terminate[/eluser]
Thank you for your help guys! Had the exact same problem. Fixed it like you said.

Replace line 395 on text_helper.php
Code:
$output .= $temp.$this->newline.$line;

For
Code:
$output .= $temp."\n".$line;
#6

[eluser]Derek Allard[/eluser]
Ah. I can explain how that got in there... but I'll instead just say "fixed".




Theme © iAndrew 2016 - Forum software by © MyBB