-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix REST search when using zero ('0') as the query parameter #1261
Conversation
Great work!
Sounds like a belt-and-suspenders approach but this seems to work fine!
Yes, these are excellent improvements! Adding type annotations is good whenever you are editing Skosmos code and these are not problematic - the minimum PHP version is currently 7.2 and it already has good support for type annotations (7.0 was a bit lacking IIRC). I'm not sure why the GitHub Actions CI jobs don't seem to have run for this PR. I can try to execute them some other way. As pointed out in this comment, a very similar problem affects also searches done via the web UI. This PR takes care of the REST side, but not the web UI searches. So I think we need another PR to fix that, but this is already a great improvement! |
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
Codecov Report
@@ Coverage Diff @@
## master #1261 +/- ##
============================================
- Coverage 69.33% 69.33% -0.01%
- Complexity 1647 1648 +1
============================================
Files 32 32
Lines 4044 4047 +3
============================================
+ Hits 2804 2806 +2
- Misses 1240 1241 +1
Continue to review full report at Codecov.
|
I still don't understand why CI actions aren't running. I reviewed the settings for this repository and there should be an approval process for first-time contributors, but I'm not seeing the approval button... I added a very minor typo fix comment to @kinow's PR branch, but that didn't trigger it either. Then I pushed the same branch into NatLibFi/Skosmos:kinow-fix-rest-search-zero . That triggered a CI run which finished successfully. All seems to be good, I'm merging this PR. Thanks again @kinow! |
Reasons for creating this PR
Prevent a string value being treated as a boolean, causing a valid search query to fail.
Link to relevant issue(s), if any
Description of the changes in this PR
isset()
and also trimming the value, and checking if thestrlen
returned iszero
.return
's have always bothered me in the controller methods 😥 so I also fixed that by usingreturn
, and annotated the params & method changed with types (I think our minimum version of PHP accepts it? if not, and CI fails, I'll revert this part)Known problems or uncertainties in this PR
Checklist