-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Make serialized SQL executors forward compatible #11027
Conversation
1698084
to
70c7b9c
Compare
f72e503
to
374e3bb
Compare
tests/Doctrine/Tests/ORM/Functional/ParserResultSerializationTest.php
Outdated
Show resolved
Hide resolved
374e3bb
to
ec1e3dd
Compare
serialized representation becomes compatible with 3.0.x, meaning | ||
there will not be a deprecation warning about a missing property | ||
when unserializing data */ | ||
return array_values(array_diff(array_keys((array) $this), ["\0*\0_sqlStatements"])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This weirdness can be understood by reading https://www.phpinternalsbook.com/php5/classes_objects/serialization.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did once some PHP shenanigans by creating private/protected stdClass properties just for fun. 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next to the review I did also a check of the occurrences of used _sqlStatements
in case if some were forgotten, but you get anyone of those rascals. 😁
$r = new ReflectionProperty($unserialized->getSqlExecutor(), '_sqlStatements'); | ||
$r->setAccessible(true); | ||
|
||
$this->assertIsString($r->getValue($unserialized->getSqlExecutor())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though _sqlStatements
is referencing sqlStatements
this test would be more understandable if you compare the contents of both properties.
$this->assertIsString($r->getValue($unserialized->getSqlExecutor())); | |
$this->assertSame($r->getValue($unserialized->getSqlExecutor()), $unserialized->getSqlExecutor()->getSqlStatements()); |
Maybe you want to create a separated test method for your changes instead of re-using testSerializeParserResult()
. One tests the serialized ParserResult, the other your forward compatiility.
ec1e3dd
to
192bb4b
Compare
Can you add a the new format to |
The idea here is that instead of having a backward compatibility layer in the next major branch, we can have a forward compatibility layer in this branch.
192bb4b
to
2a9390d
Compare
upgraded from and now code like this:
results in Exception
|
Thanks for reporting this, I will take a look. |
@PhilETaylor fixed |
Awesome - thanks. |
The idea here is that instead of having a backward compatibility layer
in the next major branch, we can have a forward compatibility layer in
this branch.
Closes #11026