Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

TokenMismatchException #202

Open
Hackmastr opened this issue Apr 10, 2016 · 6 comments
Open

TokenMismatchException #202

Hackmastr opened this issue Apr 10, 2016 · 6 comments
Labels

Comments

@Hackmastr
Copy link

Running mybb 2.0 with Laravel 5.2 gives the error:

TokenMismatchException in VerifyCsrfToken.php line 67

Apparently Laravel requieres

{{ csrf_field() }}
or 
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
@euantorano
Copy link
Member

Which page(s) does this apply to?

On 10 Apr 2016, at 20:42, Hackmastr notifications@github.com wrote:

Running mybb 2.0 with Laravel 5.2 gives the error:

TokenMismatchException in VerifyCsrfToken.php line 67
Apparently Laravel requieres

{{ csrf_field() }}
or


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@Hackmastr
Copy link
Author

@euantorano quick reply, or reply page

@Hackmastr
Copy link
Author

@euantorano now its showing

strtr(): The second argument is not an array

As i'm new to PHP and Laravel(even more), I fail to fix this

edit:

New code: 

        $emptyVar = "" ;
        $message = strtr($message, $smilies, $emptyVar);
edit:

$message = strtr($message, $smilies, $smilies);

Still have no idea what im doing

It's working fine now.

@euantorano
Copy link
Member

Interesting. The parser is going to get a major overhaul soon which will resolve that second issue. I'll look into the CSRF token.

On 10 Apr 2016, at 20:46, Hackmastr notifications@github.com wrote:

@euantorano now its showing

strtr(): The second argument is not an array
As i'm new to PHP and Laravel(even more), I fail to fix this


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@Hackmastr
Copy link
Author

@euantorano is this a good fix?

{
...
               # Array smilies
        $smilies[] = $this->smileys->getParseableSmileys();

        if (empty($smilies)) {
            return $message;
        }

        // TODO: this is mycode but it's not the parser! Should be changed as we plan to also support markdown
        // First we take out any of the tags we don't want parsed between (url= etc)
        preg_match_all(
            "#\[(url(=[^\]]*)?\]|quote=([^\]]*)?\])|(http|ftp)(s|)://[^\s]*#i",
            $message,
            $bad_matches,
            PREG_PATTERN_ORDER
        );
        if (count($bad_matches[0]) > 0) {
            $message = preg_replace(
                "#\[(url(=[^\]]*)?\]|quote=([^\]]*)?\])|(http|ftp)(s|)://[^\s]*#si",
                "<mybb-bad-sm>",
                $message
            );
        }

        $message = strtr($message, $smilies);
...
}

It works.

@euantorano
Copy link
Member

@Hackmastr yes, that should work I think, but the parser is going to get a major overhaul to make use of https://github.com/s9e/TextFormatter - which includes smileys and everything already 😄 I just need to (eventually) find the time to make the change.

@JordanMussi JordanMussi changed the title [Bug] TokenMismatchException TokenMismatchException Sep 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants