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

A textual day could not be found Not enough data available to satisfy format #44082

Closed
TheRealMkadmi opened this issue Sep 10, 2022 · 7 comments · Fixed by #44195
Closed

A textual day could not be found Not enough data available to satisfy format #44082

TheRealMkadmi opened this issue Sep 10, 2022 · 7 comments · Fixed by #44195

Comments

@TheRealMkadmi
Copy link
Contributor

TheRealMkadmi commented Sep 10, 2022

  • Laravel Version: 9.24.0
  • PHP Version: 8.1.7, Xdebug v3.1.2
  • Database Driver & Version: mysql Ver 8.0.29-0ubuntu0.22.04.2 for Linux on x86_64 ((Ubuntu))

Description:

Running on WSL 1, Windows 11

Running php artisan serve would result in the following error thrown randomly (might occur immediately or after a few minutes);

INFO  Server running on [http://127.0.0.1:8000].

  Press Ctrl+C to stop the server


   Carbon\Exceptions\InvalidFormatException 

  A textual day could not be found
Not enough data available to satisfy format

  at vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:676
    672▕             return $instance;
    673▕         }
    674▕
    675▕         if (static::isStrictModeEnabled()) {
  ➜ 676▕             throw new InvalidFormatException(implode(PHP_EOL, $lastErrors['errors']));
    677▕         }
    678▕
    679▕         return false;
    680▕     }

      +23 vendor frames 
  24  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
PHP Fatal error:  Uncaught Carbon\Exceptions\InvalidFormatException: A textual day could not be found
Not enough data available to satisfy format in <path>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:676
Stack trace:
#0 <path>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(699): Carbon\Carbon::rawCreateFromFormat()
#1 <path>/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php(289): Carbon\Carbon::createFromFormat()
#2 <path>/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php(239): Illuminate\Foundation\Console\ServeCommand->getDateFromLine()        
#3 <path>/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(264): Illuminate\Foundation\Console\ServeCommand->Illuminate\Foundation\Console\{closure}()
#4 <path>/vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php(276): Illuminate\Support\Collection->each()
#5 <path>/vendor/symfony/process/Process.php(1274): Illuminate\Foundation\Console\ServeCommand->Illuminate\Foundation\Console\{closure}()
#6 <path>/vendor/symfony/process/Process.php(1372): Symfony\Component\Process\Process->Symfony\Component\Process\{closure}()
#7 <path>/vendor/symfony/process/Process.php(1292): Symfony\Component\Process\Process->readPipes()
#8 <path>/vendor/symfony/process/Process.php(836): Symfony\Component\Process\Process->updateStatus()
#9 <path>/vendor/symfony/process/Process.php(882): Symfony\Component\Process\Process->isRunning()
#10 <path>/vendor/symfony/process/Process.php(213): Symfony\Component\Process\Process->stop()
#11 [internal function]: Symfony\Component\Process\Process->__destruct()
#12 {main}
  thrown in <path>/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 676

Steps To Reproduce:

php artisan serve for any laravel project. Would appreciate any guidance on providing further information to pinpoint the issue.
It is worth noting that I'm using the PHP_CLI_SERVER_WORKERS=6 environment variable. The problem seems to disappear without it.

@DarkGhostHunter
Copy link
Contributor

Found the commit e7ac9b1

Seems that the culprit is getDateFromLine(). Can you dump $line and $matches? It may be a problem with how WSL returns the server date. Which Ubuntu version, btw?

@TheRealMkadmi
Copy link
Contributor Author

TheRealMkadmi commented Sep 10, 2022

I'll report back as soon as it happens again
I'm on Ubuntu 22.04

@driesvints
Copy link
Member

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

@TheRealMkadmi
Copy link
Contributor Author

This is not a support question or a question on how to use the framework.
This is clearly an issue within the a core part of the framework that could be addressed with a patch. Hereby needs an issue on the bug tracker.

@TheRealMkadmi
Copy link
Contributor Author

TheRealMkadmi commented Sep 17, 2022

@DarkGhostHunter

Here's what dd($time, $format, $lastErrors); gives at line Creator.php:675:

^ "488"
^ "D M d H:i:s Y"
^ array:4 [
  "warning_count" => 0
  "warnings" => []
  "error_count" => 2
  "errors" => array:2 [
    0 => "A textual day could not be found"
    3 => "Not enough data available to satisfy format"
  ]
]

@TheRealMkadmi
Copy link
Contributor Author

TheRealMkadmi commented Sep 17, 2022

ServeCommand.php:239
$line evaluates to: [516] [Sat Sep 17 20:09:40 2022] 127.0.0.1:55020 Accepted
Seems like it's trying to parse the [516] as a date instead of the content of the second bracket

Here's the output of the PHP built in web server on my machine:

[596] [Sat Sep 17 20:20:54 2022] 127.0.0.1:55530 Closing
[595] [Sat Sep 17 20:20:54 2022] 127.0.0.1:55531 Accepted

the preg_match('/^\[([^\]]+)\]/', $line, $matches); outputs just [596] in $matches . Seems that's our problem.

@driesvints can we reopen this?

TheRealMkadmi added a commit to TheRealMkadmi/framework that referenced this issue Sep 18, 2022
PHP_CLI_SERVER_WORKERS prepends the process PID to the log line. Fixes laravel#44082
@driesvints
Copy link
Member

Seems like a PR was sent in so let's see how that goes.

taylorotwell added a commit that referenced this issue Sep 19, 2022
…ironment variable (#44204)

* Fixed erroneous date parse when running with multiple workers. 

PHP_CLI_SERVER_WORKERS prepends the process PID to the log line. Fixes #44082

* Fixed typo

* Apply fixes from StyleCI

* Avoids `Server running on..` being displayed multiple times

* Update ServeCommand.php

Co-authored-by: Wahib Mkadmi <33043525+TheRealMkadmi@users.noreply.github.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Taylor Otwell <taylor@laravel.com>
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

Successfully merging a pull request may close this issue.

3 participants