Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

addMessage should add a message, not set the group to the message #2

Closed
aoloe opened this issue Apr 26, 2021 · 5 comments
Closed

addMessage should add a message, not set the group to the message #2

aoloe opened this issue Apr 26, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@aoloe
Copy link

aoloe commented Apr 26, 2021

Hi

This morning I've tried to use your library and I fear that I stumbled on a simple bug: Flash::addMessage() should add the message not set the key to the message...

The current code is

    /**
     * {@inheritDoc}
     */
    public function addMessage(string $key, $message): FlashInterface
    {
        if (!isset($this->next[$key])) {
            $this->next[$key] = [];
        }

        $this->next[$key] = $message;

        return $this;
    }

but adding the message should imo be:

        $this->next[$key][] = $message;

Since you did define the return type of getMessages() php gave me a nice error instead of simply returning the wrong data : - ).

I will keep on testing your library, but, for now, it seems to do its job!

@jnessier
Copy link
Owner

I will deep dive into your issue in the next few hours. Thanks for submitting the bug.

@jnessier jnessier self-assigned this Apr 26, 2021
@jnessier jnessier added the bug Something isn't working label Apr 26, 2021
@aoloe
Copy link
Author

aoloe commented Apr 26, 2021

Thanks : - )

@jnessier
Copy link
Owner

Fixed the bug. Currently I do not use the lib. So thanks again for your issue!

@jnessier
Copy link
Owner

Please update the lib to the latest released version 1.0.1 to get the fix.

@aoloe
Copy link
Author

aoloe commented Apr 26, 2021

updated, tested, it works!

merssi

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants