Our blog
Flash Messenger Bug in Zend Framework + Patch
Arrgh am I going mad.. could something so simple really not work..?
It turns out that I wasn't going mad, and Flash Messenger in Zend Framework really does have a bug. If its not working for you, the following patch may well fix things. You can check if this bug applies by setting your error reporting to E_ALL in your bootstrap.
If you get the following error message then this patch should fix things for you.
-
Notice: Indirect modification of overloaded property Zend_Session_Namespace.....
To fix this problem and get FlashMessenger working correctly, you need to edit library/Zend/Controller/Action/Helper/FlashMessenger.php
find this line
-
self::$_session->{$this->_namespace}[] = $message;
and replace with this block
-
//self::$_session->{$this->_namespace}[] = $message;
-
$sessionMessages = self::$_session->{$this->_namespace};
-
$sessionMessages[] = $message;
-
self::$_session->{$this->_namespace} = $sessionMessages;
Apparently this issue only affects php 5.2 and so they have decided not to fix it and instead suggest upgrading the PHP version. If you need to get it working though the above will fix it for you.
If you want a nice tutorial about flash messenger, check out this page
More Reading:
6 Comments
|
Thanks for posting this, could not understand why the flashmessenger was working on one server but not on antoher. Thanks again. |
|
happy to help |
|
Someone give this man some money! |
|
[...] The messages array was always empty, no error message, nothing. I asked the big G again and I found this article. As you will notice this article was written in may 2009, so more than a year [...] |
|
Erik June 20th, 2010 |
I'm pretty sure this is a session bug in PHP version 5.2.1 (and below) and not so much a bug in the helper itself. Still, this is a solid fix. Thanks! |
|
One of my greatest pains when using Zend Framework is the compatibility tracking. |
RSS Feed
Johan Nilsson
March 9th, 2009