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

Warning unlinking non-existent session file in tinker #22514

Closed
phpguru opened this issue Dec 22, 2017 · 18 comments
Closed

Warning unlinking non-existent session file in tinker #22514

phpguru opened this issue Dec 22, 2017 · 18 comments

Comments

@phpguru
Copy link
Contributor

phpguru commented Dec 22, 2017

  • Laravel Version: 5.5.27
  • PHP Version: 7.1.11
  • Database Driver & Version: MySQL 5.6

Description:

Minor issue. When using Auth::attempt( ) in tinker and using the Filesystem session driver, a PHP warning is displayed trying to unlink non-existent session file.

Steps To Reproduce:

# php artisan tinker
Psy Shell v0.8.16 (PHP 7.1.11 — cli) by Justin Hileman
>>> Auth::attempt(['email' => 'you@yoursite.com', 'password' => 'yourpassword'])
PHP Warning: unlink(/Projects/myproject/storage/framework/sessions/yC9WluwkHxFwxkzIn2tLzBNo44FUCxn2HUSsno6d): No such file or directory in /Projects/myproject/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 183

Just need to check if file_exists or is_file before unlinking to avoid warning. The @ symbol in the try-catch around lines 182-188 doesn't suppress the warning.

@sisve
Copy link
Contributor

sisve commented Dec 22, 2017

Why doesn't @ suppress the warning? Do you have screaming enabled in xdebug? Using file_exists/is_file is still susceptible for racing conditions where two parallel requests attempt to delete the same file.

@vicmarconi
Copy link

When using Auth::login(User::first()) (or any user), PHP warns about unlinking an non-existing file.

Auth::login($u)
PHP Warning:  unlink(/Workspace/Project/storage/framework/sessions/bxH9ZY08LSB61t8Mx2DjkF1Olj03Pn6aW20DDBiG): No such file or directory in /Workspace/Project/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 18

@3ynm
Copy link

3ynm commented Feb 21, 2018

Same here:

>>> \Auth::loginUsingId(1)
PHP Warning:  unlink(/home/hacktivista/Development/form.report/app/private/storage/framework/sessions/lSMSUrnuunbehdGW2KW33R0bMuQ2YoeUl8FmSwpL): No such file or directory in /home/hacktivista/Development/form.report/app/private/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 183

@mizan-cs
Copy link

same problem

@sisve
Copy link
Contributor

sisve commented Mar 16, 2018

@mizan-cs Are you using xdebug with screaming enabled? Check the xdebug.scream setting.

https://xdebug.org/docs/all_settings

@faozimipa
Copy link

is any body have a solusion to this problem?

@sisve
Copy link
Contributor

sisve commented Apr 15, 2018

There is no solution to the problem because no-one is bothered to answer that very simple and specific question; Do you have screaming enabled in xdebug?

xdebug.scream
Type: boolean, Default value: 0, Introduced in Xdebug >= 2.1
If this setting is 1, then Xdebug will disable the @ (shut-up) operator so that notices, warnings and errors are no longer hidden.

Source: https://xdebug.org/docs/all_settings

You can find your setting in your configuration, or by doing var_dump(ini_get('xdebug.scream'));. Make sure you do it in the correct environment; preferably once in the terminal and once from a controller called via http, just to be sure that it's disabled in both.

@phpguru @vicmarconi @mizan-cs @faozimipa You're welcome to report your result in this issue. If you have screaming enabled, disable it. If you have screaming disabled, then there's an issue we need to debug further.

@3ynm
Copy link

3ynm commented Apr 17, 2018

I can confirm that screaming is disabled in my case
image

@aristarchusSkywatcher
Copy link

same here on laravel 5.6.20 and PHP 7.1.17

@markvesterskov
Copy link
Contributor

markvesterskov commented May 31, 2018

skaermbillede 2018-05-31 kl 20 39 59

Laravel v5.6.7 and PHP 7.2 on Homestead.

Another buzz for this issue.

It might be just a nuisance, but I have a slight hunch that it might be causing my queues to silently fail, because i have issues running them on my Homestead box whenever something session-touchy is involved. They get called but die silently.

Even tried updating php.ini's error_reporting to only E_ERROR on both FPM and CLI, to no avail.

@BautistaJB
Copy link

Same problem here, using PHP 7.0 and Laravel 5.4.

I realized this problem was in my project because the authentication stopped working when I installed the project in a new environment. Then I tried using Auth::attempt directly from php artisan tinker and saw the "unlink warning":

image

Just to be sure, I tried to fix it adding this lines where the error ocurrs (vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:183):

image

Now the Warning is gone, but I cannot still log in my app.

@aristarchusSkywatcher
Copy link

Same problem here with PHP 7.1.17 and Laravel 5.6.18.

I haven't enabled xdebug yet.

@martijnimhoff
Copy link

Also having this problem: php 7.2.15 and Laravel v5.6.39

@marcosdipaolo
Copy link

any solution?

not using xdebug here

@jeremiahsherrill
Copy link

also looking for a solution

@riyuk
Copy link
Contributor

riyuk commented May 16, 2019

@sisve @themsaid this error even occurs in forge - where no xdebug is present.

@marcosdipaolo
Copy link

marcosdipaolo commented Sep 7, 2019

What was the answer to this problem?

@riyuk
Copy link
Contributor

riyuk commented Sep 7, 2019

See my Ticket on honeybadger. This error is supressed by default (with a @). You will get errors anyway if you have defined a custom error reporter or use xdebug it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests