PHP Laminas Framework Flash Messenger replaces space with " + "

158 Views Asked by At

message when creating

The flash messenger replaces the message spaces with the " + " symbol when trying to create something, but it works perfectly when updating.

message when updating

How to remove the " + " symbol?

code for creating

            // success
            $text = $this->translate('The group %s has been created successfully.');
            $message['success'] = sprintf($text, $group['name']);
            $cookie = new SetCookie('newGroup', $group['name'], time() + 30, '/');
            $this->getResponse()->getHeaders()->addHeader($cookie);
            if (isset($post['isAPIData']) && $post['isAPIData'] == 1) {
                $isAPIResponse = 1;
            } else {
                if (!$request->isXmlHttpRequest()) {
                    $this->flashMessenger()->addSuccessMessage($message['success']);
                    return $this->redirect()->refresh();
                }
            }

code for updating

            // success
            $text = $this->translate('The group %s has been updated successfully.');
            $message['success'] = sprintf($text, $group['name']);
            if (isset($post['isAPIData']) && $post['isAPIData'] == 1) {
                $isAPIResponse = 1;
                return [
                    'message'  => $message,
                    'isAPIResponse' => $isAPIResponse
                ];
            } else {
                if (!$request->isXmlHttpRequest()) {
                    $this->flashMessenger()->addSuccessMessage($message['success']);
                    $this->redirect()->refresh();
                }
            }

when var_dump($message['success']) the output is correct var_dump($message['success']) output

how to fix this?

0

There are 0 best solutions below