Postponed (maintainer needs more info)
Project:
Automatic Updates
Version:
3.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Oct 2022 at 12:44 UTC
Updated:
17 Apr 2023 at 08:37 UTC
Jump to comment: Most recent
Comments
Comment #2
tedbowComment #3
tedbowComment #4
yash.rode commentedComment #6
yash.rode commentedComment #7
yash.rode commentedComment #8
yash.rode commentedChanges in
package_manager/src/ComposerInspector.phpcan be removed once #3351883: \Drupal\package_manager\ComposerInspector::getInstalledPackagesList should use realpath() when checking metapackage path is in.Comment #9
yash.rode commentedPostponed on #3351883: \Drupal\package_manager\ComposerInspector::getInstalledPackagesList should use realpath() when checking metapackage path
Comment #10
yash.rode commentedComment #11
yash.rode commentedBlocker is merged!
Comment #12
yash.rode commentedDiscussed this with @tedbow, we should check this for all the occurrences of json_decode not only build tests!
Comment #13
omkar.podey commentedComment #14
omkar.podey commentedLooks good but i wonder what about
Json::Decodedo we replace all those instance withjson_decodeand add the flags ? OR is there a reason we useJson::Decodein some places.Comment #15
omkar.podey commentedComment #16
yash.rode commentedComment #17
omkar.podey commentedAll instances of
Json::Decodeare now replaced, everything else looks good already. , nice work.Comment #18
tedbowreviewing
Comment #19
tedbowLooks good! thanks!
Comment #20
tedbowComment #21
phenaproximaComment #22
phenaproximaComment #23
phenaproximaThe repetition here concerns me. Maybe this calls for a utility method on
ComposerInspectorto always decode JSON the same way. What do you think, @tedbow?Comment #24
phenaproximaDiscussed with @tedbow.
I really don't want to repeat the same call a million times -- in the best case, it's sometimes unnecessary, and in the worst case, it's fragile when spread widely over the codebase.
I've gone through this with a fine-tooth comb and suggested where, IMHO, we should keep the JSON_THROW_ON_ERROR flag, where we should revert it, and where we should replace it with something else. Leaving assigned to @tedbow to implement these changes, since he may have different ideas than me about what should be changed.
Comment #25
tedbow@phenaproxima mostly accepted your suggestions. Commented on the others in the MR
Comment #26
phenaproximaGenerally I'm okay with your decisions, but there are a couple of places where I don't...thoughts? Also, tests are failing, so kicking back for that.
Comment #27
tedbowWe need more of summary for this to be reviewable otherwise we can't know if is correct
Comment #28
tedbow@phenaproxima since you made the comment the quoted in the original issue to add one instance of `JSON_THROW_ON_ERROR` and then this issue started to add them everywhere and then we removed them again could you update the summary to what the goal and proposed solutions is here
Comment #29
phenaproximaComment #30
phenaproximaComment #31
phenaproximaOkay, I updated the summary. Assigning back to @tedbow to respond to my feedback (and hopefully fix the broken tests).
Comment #32
tedbowComment #33
phenaproximaDiscussed with @tedbow on Zoom.
I really, really don't like the repetition, and the need to always pass the recursion depth, but Ted correctly pointed out that adding a protected static method on TemplateProjectTestBase would, by core's policies, be considered API. Even if we explicitly marked the base class internal.
Neither of us likes that policy one bit. The concept of "internal" is rendered utterly meaningless if we don't stand by it in practice. However, this is a core policy that we have to abide by, at least for now, until it changes in a more sane direction. I hereby shake my fist and growl at the policy, and call it a dummkopf.
But, then I had an idea: we could take advantage of PHP 8's support for named arguments, and leave out the recursion depth. So this:
Becomes this:
This is a compromise I can live with. True, we'd be repeating the call several times because of core's dumb policy, but we also wouldn't need to pass a worthless and confusing extra argument.
Comment #34
tedbowimplemented #33
Comment #35
phenaproximaLooks good to when tests pass.
Comment #37
phenaproximaComment #38
wim leersThe use of named parameters thanks to PHP 8 makes sense. 👍
The inconsistent updating in this commit of some
json_decode()calls toJson::decode()instead, whereas in other cases doing the exact opposite makes no sense to me. I see there's been discussion about this, but I don't see a conclusion documented anywhere and I cannot discern any pattern.For example:
package_manager/src/Validator/AllowedScaffoldPackagesValidator.phpwas updated to START usingJson::decode()package_manager/src/Validator/AllowedScaffoldPackagesValidator.phpwas updated to STOP usingJson::decode()It appears that the pattern is to use
Json::decode()in all non-test cases except in cases where we want to set theJSON_THROW_ON_ERRORflag? But why do we want that flag in the one case but not in the other?That information is missing from the issue's comments.