- Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Closed
Copy link
Labels
Description
Laravel Version
11.43.0
PHP Version
8.2.27
Database Driver & Version
MySQL
mysql Ver 8.0.41-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
Description
When using implode() with 2 arguments, the output has changed. The object gets serialised as json as a result.
> User::take(1)->get()->implode('name', ','); = "{"id":1,"status":"active","stage":"approve","first_name":"first","last_name":"last", (remaining serialization redacted) In 11.42.1 this is the output:
> User::take(1)->get()->implode('name', ','); [!] Aliasing 'User' to 'App\Models\User' for this Tinker session. = "first last" I believe the offending commit is 9626c3d
Upon removing the added \ at Collection.php:631 in that commit, the issue was resolved.
Steps To Reproduce
-
Create a new laravel application: https://laravel.com/docs/11.x/installation#creating-a-laravel-project
-
In tinker, run the following
> User::create(['name' => 'Firstname Last', 'email' => 'first@last.com', 'password' => Hash::make('password')]); = App\Models\User {#6194 name: "Firstname Last", email: "first@last.com", #password: "...", updated_at: "2025-02-19 01:41:00", created_at: "2025-02-19 01:41:00", id: 1, } > User::take(1)->get()->implode('name', ', '); = "{"id":1,"name":"Firstname Last","email":"first@last.com","email_verified_at":null,"created_at":"2025-02-19T01:41:00.000000Z","updated_at":"2025-02-19T01:41:00.000000Z"}" - Observe the JSON encoded output in
v11.43.0. This does not occur inv11.42.1
EK1771, shane-zeng, sebdesign, ekateiva and yvoitenko