-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection][FrameworkBundle] Use php-serialize to dump the container for debug/lint commands #60597
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
base: 7.4
Are you sure you want to change the base?
Conversation
965f23d
to
013e6ce
Compare
$container->getCompilerPassConfig()->setBeforeOptimizationPasses([]); | ||
$container->getCompilerPassConfig()->setOptimizationPasses([]); | ||
$container->getCompilerPassConfig()->setBeforeRemovingPasses([]); | ||
if (str_ends_with($file, '.xml') && is_file(substr_replace($file, '.ser', -4))) { |
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.
The .ser
file name extension seems common in Java. It makes sense to use it for serialized data in PHP too.
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.
So you agree with this line, that's what you mean, isn't it?
e804022
to
930c4a6
Compare
*/ | ||
trait ArgumentTrait | ||
{ | ||
public function __serialize(): array |
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 figured out that the resulting serialized payload had a LOT of repeated strings.
The added __serialize
methods reduce its size from 2.8M to 829K on a skeleton webapp.
This might be interesting to Drupal folks I suppose /cc @alexpott
For reference, the xml is 590K.
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.
should we add tests covering the fact that serializing an argument and then unserializing it works fine, to avoid introducing bugs in that logic (which seems to rely on the fact that the default unserialization of PHP is able to process the returned data without implementing __unserialize
) ?
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.
btw, this might also prevent contributors from reverting the usage of default property values (submitting a PR to use constructor promoted properties again).
930c4a6
to
f22faac
Compare
f22faac
to
fca2a84
Compare
…container for debug/lint commands
fca2a84
to
c128f55
Compare
To unlock #60568 this uses
serialize()
to dump the container, next to the XML dump.