laravel / tinker

Powerful REPL for the Laravel framework.
https://laravel.com/docs/artisan#tinker
MIT License
7.32k stars 130 forks source link

The destructor is not executed #157

Closed martio closed 1 year ago

martio commented 1 year ago

Description:

Recently I noticed that the class destructor is not executed. I checked on an old version of Tinker and it's OK.

Steps To Reproduce:

Zrzut ekranu 2022-12-30 o 11 36 43
driesvints commented 1 year ago

Tinker is a long running process. A destructor isn't executed here.

bobthecow commented 1 year ago

The destructor will be executed the next time you type anything:

Screenshot 2022-12-30 at 11 44 29 AM

PsySH keeps a reference to the most recent return value around in the $_ magic variable, so you've gotta do something to clear that out before the destructor will be called:

Screenshot 2022-12-30 at 11 45 53 AM

You'd have similar issues with the $_e magic variable.