8000 [9.x] Cast Stringable to string when used with json_encode() by crynobone · Pull Request #35680 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[9.x] Cast Stringable to string when used with json_encode() #35680

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

Merged
merged 3 commits into from
Dec 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update Stringable.php
  • Loading branch information
taylorotwell authored Dec 20, 2020
commit 66bd5f231293b59c249d98505223752e666af9f6
18 changes: 9 additions & 9 deletions src/Illuminate/Support/Stringable.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,24 +724,24 @@ public function dd()
}

/**
* Proxy dynamic properties onto methods.
* Convert the object into something JSON serializable.
*
* @param string $key
* @return mixed
* @return string
*/
public function __get($key)
public function jsonSerialize()
{
return $this->{$key}();
return $this->__toString();
}

/**
* Convert the object into something JSON serializable.
* Proxy dynamic properties onto methods.
*
* @return string
* @param string $key
* @return mixed
*/
public function jsonSerialize()
public function __get($key)
{
return $this->__toString();
return $this->{$key}();
}

/**
Expand Down
0