-
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
Add compatibility with the Symfony 4.4 VarExporter #10948
Conversation
Is there a way we can test this? 🤔 Also, can we revert this change on 3.0.x? |
In #10684, you introduced txt files containing serialized data. Maybe there should be a new text file with the 3rd format in it? |
The txt files containing serialized data was not really working for me as Symfony directly call's the
I'm not sure. If But maybe the whole |
Symfony 4.4 is EOL, so yes, we won't support it on the 3.0.x branch. |
Can we actually use |
If there is a way to ensure we get the Symfony |
We do run our tests against VarExporter 4.4, yes. |
I have rewriten the test to only validate it when symfony/var-exporter versie |
a936549
to
0966b3d
Compare
Why? I understand that the problem is only reproducible with VarExporter 4, but the test should pass with any version, shouldn't it? |
Yes, you are right did not think about that. I removed the skip. |
$data = file_put_contents($tempFile, '<?php return ' . $exported . ';'); | ||
|
||
$unserialized = require $tempFile; |
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 is a complicated way to perform an eval()
, isn't it?
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'm not sure how i can solve this i followd the Symfony docs which has noted it to use it this way.
use Symfony\Component\VarExporter\VarExporter;
$exported = VarExporter::export($someVariable);
// store the $exported data in some file or cache system for later reuse
$data = file_put_contents('exported.php', '<?php return '.$exported.';');
// later, regenerate the original variable when you need it
$regeneratedVariable = require 'exported.php';
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.
What we maybe could do is dump the file once, commit it and then use the output to validate. But then we still need a way to import the file which is the part your question is about. So maybe this is still not the way. 🤔
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.
You don't need a file. PHP has eval()
. Use that.
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 have pushed a update to use eval
instead.
tests/Doctrine/Tests/ORM/Functional/ParserResultSerializationTest.php
Outdated
Show resolved
Hide resolved
@derrabus I have updated the code with the feedback. When you have time can you check if this is what you expected? |
Thank you! |
Thank you too! |
Yes, Thank you too! ❤️ |
This issue tries to solve the weird Symfony
__unserialize
data Symfony4.4
is giving to the method. This seems to be a bug that Symfony solved in5.4
in symfony/symfony@6ccb85e. Original report / investigation #10943.