Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing arrays not working propably #18

Closed
timwattenberg opened this issue Feb 26, 2016 · 2 comments
Closed

Passing arrays not working propably #18

timwattenberg opened this issue Feb 26, 2016 · 2 comments

Comments

@timwattenberg
Copy link
Contributor

I'm experiencing an issue where an array is not passed probably via flash messages.

I followed the setup from the README, further setup:

// First request
$this->flash->addMessage('inputs', ['test' => 'input']);

// Second request
var_dump($this->flash->getMessages()['inputs'][0]); // => string(5) "Array"
@ManeVenture
Copy link

I was experiencing a similar issue, which was strange to me when considering the readme note below Usage:
"Please note that a message could be a string, object or array. Please check what your storage can handle."

I took a look at the src and noticed this:

public function addMessage($key, $message)
    {
        //Create Array for this key
        if (!isset($this->storage[$this->storageKey][$key])) {
            $this->storage[$this->storageKey][$key] = array();
        }

        //Push onto the array
        $this->storage[$this->storageKey][$key][] = (string)$message;
    }

Notice in the push the type cast to (string). Given the note I am unsure if this is intended for the final design. For my purpose I have removed this typecasting. (Be warned that there may be unintended results from doing so)

@timwattenberg
Copy link
Contributor Author

@ManeVenture This is already fixed in the upstream version, but since there is no official release other then 0.1.0 composer uses this by default (which still has the type cast).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants