zf1s / zf1

Monorepo of a fork of Zend Framework 1, with all components split into individual composer packages. PHP 5.3-8.3 compatible.
BSD 3-Clause "New" or "Revised" License
57 stars 22 forks source link

Zend_Session_SaveHandler_DbTable causes a warning under PHP 7 when the row is unchanged #162

Closed fredericgboutin-yapla closed 1 year ago

fredericgboutin-yapla commented 1 year ago

Source: https://github.com/zendframework/zf1/issues/665

We are migrating a project from PHP 5.6 to 7.4 and we encountered this problem using zf1s.

The important part to understand is this,

The problem is, at least for the Mysqli driver, a row isn't "affected" by a statement if it's UPDATE'd with the exact same data already stored in that row. This doesn't happen too often because the save handler saves the modified time with the row, so that timestamp and thus the row changes every second.

So basically, we have a view with a couple of ajax calls and sometimes they generate a warning because the session didn't change (same second, same content).

Anyways, I saw that zf1-future implemented a simple fix for this, see https://github.com/Shardj/zf1-future/commit/9175301058d324bcdcdca0d091b2e6c394273a95

Basically the workaround proposed by virtually everyone in the community is to inherit the class and force a return true - see https://github.com/zendframework/zf1/pull/654#issuecomment-252055139.

I think it would be handy for zf1s to support / fix this scenario instead.

fredericgboutin-yapla commented 1 year ago

Oh, I'm an idiot. I just saw this issue opened 2 years ago - https://github.com/zf1s/zf1/issues/23

Here is the thing: I'm going to yoink zf1-future fix and pull request here if I'm able to use my forked version with the fix. Doing so, I will be able to confirm if the fix works.

( I know it works since I switched from zf1s to zf1-future just to try it )

fredericgboutin-yapla commented 1 year ago

There it is, https://github.com/zf1s/zf1/pull/163

fredericgboutin-yapla commented 1 year ago

First time contributor so multiple things went wrong as pointed out by @glensc here https://github.com/zf1s/zf1/pull/163#issuecomment-1362722023

I started from scratch using Github Desktop so here is the new proper pull request: https://github.com/zf1s/zf1/pull/164