Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
jsonapi.module
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
6 Jun 2020 at 13:33 UTC
Updated:
13 Sep 2021 at 13:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
naresh_bavaskarComment #4
pavnish commentedWorking on it
Comment #5
pavnish commented@naresh_bavaska found some wrong code in #2
Please review this patch.
Comment #6
naresh_bavaskar@pavnish, Thanks for correcting the code, LGTM, +RTBC
Comment #7
wim leersI really wondered why this was the case, so I dug in and … ahhh … that's because it was introduced in https://git.drupalcode.org/project/jsonapi/-/commit/30559bfaf5055505fad4..., for a security issue. To minimize disruption, it was decided by the security team to not use dependency injection.
Nice catch 👍
Comment #8
wim leersAnd nice collaboration 😊
Comment #9
alexpottSo this class is marked @internal but it is extended and the service decorated in https://www.drupal.org/project/jsonapi_cross_bundles - I don't think this will break because of the way the decoration and class extension is done. But it would be good to confirm that this is the case.
A more traditional way of adding an argument is allowing it to be NULL and then triggering a deprecation if it is not supplied. I think even though this is marked as @internal we should make best effort to not break contrib / custom code so should consider doing the deprecation dance here. We'll get to require the argument in D10.
Comment #12
bbralaAs requested @alexpott, the deprecation dance. ^^
Comment #13
bbralaComment #14
wim leersCan't spot any problem! 🤓
Comment #15
bradjones1I had a question about whether this should be a nullable parameter type but TIL that
= nullin a parameter implies?.Comment #16
bbralaTo be honest, I double checked core for examples of this construct to be sure its supported :)
Comment #17
wim leers@bradjones1 IIRC
Something $something = NULLpredates nullable types :)Comment #18
alexpottCommitted f928fe9 and pushed to 9.3.x. Thanks!