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

Fix Zend_Session_SaveHandler_DbTable->write triggering warning #23

Merged
merged 3 commits into from
Oct 22, 2019

Conversation

Dringho
Copy link

@Dringho Dringho commented Oct 21, 2019

Mute warning when using Zend_Session_SaveHandler_DbTable.

Mute warning when using Zend_Session_SaveHandler_DbTable.
@Shardj
Copy link
Owner

Shardj commented Oct 21, 2019

Hi, what warning are you getting? It's better for you to simply fix warnings rather than supress them.

Revert
update returns 0 if the data being updated matches the one in the database, which produces a `false` return, which in turn triggers a warning in Zend_Session::writeClose - session_write_close()
@Dringho
Copy link
Author

Dringho commented Oct 21, 2019

@Shardj I took the time to find and fix the bug in the best possible way. In this case, the chain of events is

Zend_Session_SaveHandler_DbTable->_destruct triggers Zend_Session::writeClose. This in turn triggers a Zend_Session_SaveHandler_DbTable::write through session_write_close
if the data being updated matches the one in the database, the update returns 0, which returns false in turn, and then session_write_close triggers the Failed to write session data using user defined save handler. error as explained in https://stackoverflow.com/questions/43636109/php7-session-warning-session-write-close (Started happening in PHP 7).

If there is an error on the configuration, the update will throw an exception instead of returning 0.

@Dringho Dringho changed the title Mute warning Zend_Session_SaveHandler_DbTable Fix Zend_Session_SaveHandler_DbTable->update triggering warning Oct 21, 2019
@Dringho Dringho changed the title Fix Zend_Session_SaveHandler_DbTable->update triggering warning Fix Zend_Session_SaveHandler_DbTable->write triggering warning Oct 21, 2019
@Shardj
Copy link
Owner

Shardj commented Oct 22, 2019

Alright, thanks. This is an annoying php 7 change. But since try catch for Zend_Session_SaveHandler_Exception should be used to detect issues when writing data anyway it's acceptable. I'll tag this as a major change as it can possibly change functionality for some people.

@Shardj Shardj closed this Oct 22, 2019
@Shardj Shardj reopened this Oct 22, 2019
@Shardj
Copy link
Owner

Shardj commented Oct 22, 2019

Sorry wrong button there

@Shardj Shardj merged commit 62628f6 into Shardj:master Oct 22, 2019
@Shardj
Copy link
Owner

Shardj commented Oct 22, 2019

This is now part of release-1.15.0

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

Successfully merging this pull request may close these issues.

2 participants