lundi 28 mars 2016

FatalErrorException: Input string is too long

I've started to build a new Laravel 5 app. I need a site message feature in my app, so I created one. But now when I'm trying to add messages into stack, I'll get the following error:

FatalErrorException in ExceptionHandler.php line 412: Input string is too long

Apache error log says:

Mon Mar 28 20:25:40.310761 2016] [fcgid:warn] [pid 2075:tid 3028430848] [client 127.0.0.1:56643] mod_fcgid: stderr: PHP Fatal error: Input string is too long in /Users/xxx/Development/Laravel/myapp/vendor/symfony/debug/ExceptionHandler.php on line 412, referer: http://app.dev/page/new

I call Message::set method in my controller:

Message::set('Page created');

And the Message class contains:

<?php

namespace App\Models;

use Session;

class Message {

    const MESSAGE_INFO      = 0x1;
    const MESSAGE_WARNING   = 0x2;
    const MESSAGE_ERROR     = 0x3;

    public static function set($message, $type = MESSAGE_INFO) {
        $messages = self::get(false);
        $messages[$type][] = $message;

        Session::put('app.messages', $messages);
    }

    public static function get($flush = true) {
        $default = [ self::MESSAGE_INFO => [], self::MESSAGE_WARNING => [], self::MESSAGE_ERROR => []];

        if($flush) Session::pull('app.messages', $default);
        return Session::get('app.messages', $default);
    }

    public static function isAny() {
        $messages = self::get(false);

        foreach($messages AS $store) if(!empty($store)) return true;

        return false;
    }

}

I'm so lost with this. Can someone help me with this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TeCT1B
via IFTTT

Aucun commentaire:

Enregistrer un commentaire