lorenzo / audit-stash

Flexible and rock solid audit log tracking for CakePHP 3
MIT License
78 stars 37 forks source link

Implement __serialize to avoid deprecation warning on php 8.2 #80

Closed nicosp closed 9 months ago

nicosp commented 10 months ago

Fixes the following on PHP 8.2:

AuditStash\Event\AuditUpdateEvent implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)
dereuromark commented 9 months ago

This does seem to miss a test But fair enough

nicosp commented 9 months ago

This does seem to miss a test But fair enough

I thought this was covered as part of testing with php 8.2.

dereuromark commented 9 months ago

dont think so, it only says so far the class is valid (no syntax error). no assert on the method returns yet.

nicosp commented 9 months ago

dont think so, it only says so far the class is valid (no syntax error). no assert on the method returns yet.

I might be missing something but the tests are:

$serialized = serialize($event);
$this->assertEquals($event, unserialize($serialized));

My understanding is that php 8.2 will automarically use the __ methods while previous versions will use the non-underscored versions.

dereuromark commented 9 months ago

OK, in that case you seem to be right.