Needs review
Project:
Key
Version:
8.x-1.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Apr 2023 at 14:23 UTC
Updated:
8 Jul 2026 at 10:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
arkener commentedComment #5
ranjit1032002Created MR!11 for the issue mentioned, please review.
Thank You.
Comment #6
yovinceThanks, @Ranjit1032002 for the patch. The code looks good to me, and it fixed our issue.
Comment #8
cmlaraThe current MR proposes adding return types to the method that conflict with the interface.
The alternative here is that the interface is 100% accurate and the methods returning NULL/FALSE are wrong.
I will note there is no API documented method to indicate an error, it appears the interface was written with the assumption of success always occurring.
Comment #9
rajeshreeputraAdded return type to all interfaces to discuss and finalise accordingly. Then will add return type to all methods in classes.
Comment #10
cmlara@rajeshreeputra
That seems significantly out of scope for this issue.
The latest MR makes the API problem worse.
Adding type hints and return types this would generally need to be a new major only change as it breaks compatibility for those of us who have built modules implementing these interface.
Suggest addressing on the feedback from #9, that rather than assuming the API is wrong perhaps the code itself is wrong.
Consider the fact that most of ecosystem is likely not checking for a NULL return (due to API spec) and allowing it does r make sense. An exception would be better since it should be an abnormal condition.
Comment #11
yovinceThe later commits made things more complicated... I'm uploading a patch just for use in my project. Thanks.
Comment #12
rajeshreeputraAgree with you that this will introduce compatibility issues and should be implemented only in a new major version. The commit has been removed.
Comment #14
mxr576Needs review ++
Comment #15
ptmkenny commentedWorking on the Key Per User module, I came across this issue today. Key Per User uses Sodium encryption keys for each user account. Previously, I used an empty string for the anonymous user account, but because of #3608554: Validate key length when checking dependencies (my commit), Sodium module now validates key length, so I used NULL instead of the empty string, but that causes tests to fail because the interface is marked as returning string, even though some of the providers in the module also return NULL.
So, my view is that instead of forcing NULL to be an empty string, we should go the other way and change the interface to allow NULL as well. If we force everything to be a string, we can't do key length validation and allow empty/null values.