-
Notifications
You must be signed in to change notification settings - Fork 11.4k
[5.1] Fix getting an inaccessible properties from the request when isset() or empty() is called #10431
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
Conversation
…g isset() or empty()
I think that you should create some tests. Thanks for your help! |
For sure, but i need some help to start it. On /tests where is the correct class to inset my assertions? Laravel doesn't have Request tests? |
|
Yeah, you're right i haven't check return type from __isset before. I'' fix it. bool isset ( mixed public bool __isset ( string $name ) http://php.net/manual/en/language.oop5.overloading.php |
@kneipp current commit will not check exactly if You should check from where I'll tell more in next... |
It call first In first case, you can use the
|
@rentalhost I have tested current commit with $request->title on controller: |
@kneipp For original commit it'll works, but not was implemented correctly, basically you copy/paste the |
@rentalhost does this make sense or can be broken?
|
/** | ||
* Get an input element from the request when isset() or empty() is called on inaccessible properties. | ||
* | ||
* @param $key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect
@kneipp It make sense in this specific case, but you can't ignore that |
*/ | ||
public function __isset($key) | ||
{ | ||
return isset($key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will ALWAYS return true...
I'm working on this fix. When I get at home I do a pull request. |
I guess it's ok now. |
You forget to check the route parameters that can be returned by __get too. |
Get an input element from the request when isset() or empty() is called on inaccessible properties.
More details:
#10403 (comment)
https://gist.github.com/kneipp/aee5802d08505d605676
http://php.net/manual/en/language.oop5.overloading.php#object.isset