Skip to content
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

Avoid TypeError when params contain a key without a value on Ruby < 2.4 #1517

Merged
merged 1 commit into from Feb 7, 2019

Conversation

segiddins
Copy link
Contributor

Fixes #1514

@segiddins
Copy link
Contributor Author

This ought to go green when rebased atop #1513

Copy link
Member

@namusyaka namusyaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request, this looks good to me with a nit.

## Unreleased

* Avoid `TypeError` when params contain a key without a value on Ruby < 2.4 [#1516](https://github.com/sinatra/sinatra/pull/1516) by Samuel Giddins

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to update CHANGELOG.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contributing.md said it made it easier to do releases when PRs included changelog entries 😉

Copy link
Member

@namusyaka namusyaka Feb 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog entry will automatically be generated by the release script: #1515
contributing.md will also be updated at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/sinatra/sinatra/blob/master/CONTRIBUTING.md#have-a-patch #4 says to update the changelog, I was just following the instructions 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@segiddins Yes, I apologize if confusing.
But as I said earlier, the contents of contributing.md will be updated soon.
Do you want to keep your own changelog entry so much?
If not, please remove the entry from changelog.

Copy link
Contributor

@junaruga junaruga Feb 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is not #1516 but #1517. That confused me a little :)

[#1516](https://github.com/sinatra/sinatra/pull/1516)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agh, I was trying to figure out which PR it would be before opening it

@namusyaka namusyaka changed the title Support nil param on Ruby < 2.4 Avoid TypeError when params contain a key without a value on Ruby < 2.4 Feb 7, 2019
@namusyaka namusyaka merged commit 2e36823 into sinatra:master Feb 7, 2019
@segiddins segiddins deleted the segiddins/nil-param branch February 8, 2019 05:47
@RaVbaker
Copy link

RaVbaker commented Mar 14, 2019

Just realized it doesn't cover one other case. When the parameter is true Because in Ruby <=2.3 also making a dup on true is prohibited. While this PR will cover the false and nil cases. Yet not the true.

> true.dup
TypeError: can't dup TrueClass

while in >=2.4

> true.dup
=> true

And yet in JSON body payloads there can be a true, false or null/nil. Which are not dup-able in older Rubies. @segiddins @namusyaka

@dentarg
Copy link
Member

dentarg commented Mar 15, 2019

@RaVbaker do you have a repro for the issue? I think it is better to open up a new issue than commenting here

@namusyaka
Copy link
Member

@RaVbaker Good catch, I'll work on the issue soon

namusyaka added a commit that referenced this pull request Apr 11, 2019
The original fixes are #1506 and #1517.
This commit considers `FrozenError` and `TypeEror` for the case.
namusyaka added a commit that referenced this pull request Apr 11, 2019
The original fixes are #1506 and #1517.
This commit considers `FrozenError` and `TypeEror` for the case.
namusyaka added a commit that referenced this pull request Apr 22, 2019
The original fixes are #1506 and #1517.
This commit considers `FrozenError` and `TypeEror` for the case.
@dentarg dentarg mentioned this pull request Dec 30, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants