Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Fix (un)serialization for Reflection* objects - PHP 7.4 #30

Merged
merged 2 commits into from
Oct 16, 2019
Merged

Fix (un)serialization for Reflection* objects - PHP 7.4 #30

merged 2 commits into from
Oct 16, 2019

Conversation

michalbundyra
Copy link
Member

Fixes #29

. Reflection objects will now generate an exception if an attempt is made
to serialize them. Serialization for reflection objects was never
supported and resulted in corrupted reflection objects. It has been
explicitly prohibited now.

https://github.com/php/php-src/blob/php-7.4.0RC3/UPGRADING

Now in our objects we are storing internally declaring names (class name/function name/parameter name) so we can create reflection object on wakeup. Reflection object is not serialized, just the names.

/cc @remicollet

private properties of abstract class cannot be serialized on PHP versions
prior to 7.4.

Changed these properties to protected so we don't need to do anything
extra on unserialization.
@remicollet
Copy link

LGTM, thanks

+ php74 /usr/bin/phpunit7 --verbose
PHPUnit 7.5.16 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.0RC4
Configuration: /dev/shm/BUILD/zend-server-23a2e9a5599c83c05da831cb7c649e8a7809595e/phpunit.xml.dist

...............................................................  63 / 125 ( 50%)
..............................................................  125 / 125 (100%)

Time: 62 ms, Memory: 8.00 MB

OK (125 tests, 305 assertions)

@weierophinney weierophinney merged commit 70eb7e6 into zendframework:master Oct 16, 2019
weierophinney added a commit that referenced this pull request Oct 16, 2019
…n-php-7.4

Fix (un)serialization for Reflection* objects - PHP 7.4
weierophinney added a commit that referenced this pull request Oct 16, 2019
weierophinney added a commit that referenced this pull request Oct 16, 2019
@weierophinney
Copy link
Member

Thanks, @webimpress

@michalbundyra michalbundyra deleted the hotfix/reflection-serialization-php-7.4 branch October 16, 2019 18:28
@michalbundyra michalbundyra added this to the 2.8.1 milestone Oct 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP 7.4 compatibililty
4 participants