From cd68b9cb6b2eb8d3b2048acbef74edcd44862380 Mon Sep 17 00:00:00 2001 From: naquad Date: Fri, 23 Feb 2024 18:17:02 +0200 Subject: [PATCH] reproduction of laravel/framework#49890 --- .env.example | 8 +- README.md | 74 ++++--------------- app/Console/Commands/PocCommand.php | 49 ++++++++++++ app/Jobs/ProcessRecord.php | 34 +++++++++ app/Models/Record.php | 15 ++++ ...2024_02_23_160112_create_records_table.php | 28 +++++++ 6 files changed, 143 insertions(+), 65 deletions(-) create mode 100644 app/Console/Commands/PocCommand.php create mode 100644 app/Jobs/ProcessRecord.php create mode 100644 app/Models/Record.php create mode 100644 database/migrations/2024_02_23_160112_create_records_table.php diff --git a/.env.example b/.env.example index 208fe39..2b32fa0 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ APP_NAME=Laravel APP_ENV=local -APP_KEY= +APP_KEY=base64:EcXczznJFhqpOEm3Pk5h8s9Q5lVJpXdjc2IJ9UbUe5s= APP_DEBUG=true APP_URL=http://localhost @@ -8,7 +8,7 @@ LOG_CHANNEL=stack LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug -DB_CONNECTION=mysql +DB_CONNECTION=sqlite DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=bug_report @@ -16,9 +16,9 @@ DB_USERNAME=root DB_PASSWORD= BROADCAST_DRIVER=log -CACHE_DRIVER=file +CACHE_DRIVER=redis FILESYSTEM_DISK=local -QUEUE_CONNECTION=sync +QUEUE_CONNECTION=redis SESSION_DRIVER=file SESSION_LIFETIME=120 diff --git a/README.md b/README.md index 1a4c26b..20c6589 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,18 @@ -

Laravel Logo

+# Bug Reproduction -

-Build Status -Total Downloads -Latest Stable Version -License -

+A proof of concept for the misbehavior of the ShouldBeUnique mechanism +with the missing model. -## About Laravel +Issue: [https://github.com/laravel/framework/issues/49890](https://github.com/laravel/framework/issues/49890) -Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: +Pull request with the fix: [https://github.com/laravel/framework/pull/50211](https://github.com/laravel/framework/pull/50211) -- [Simple, fast routing engine](https://laravel.com/docs/routing). -- [Powerful dependency injection container](https://laravel.com/docs/container). -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. -- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). -- Database agnostic [schema migrations](https://laravel.com/docs/migrations). -- [Robust background job processing](https://laravel.com/docs/queues). -- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). +Execute the following: -Laravel is accessible, powerful, and provides tools required for large, robust applications. - -## Learning Laravel - -Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. - -You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. - -If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. - -## Laravel Sponsors - -We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com). - -### Premium Partners - -- **[Vehikl](https://vehikl.com/)** -- **[Tighten Co.](https://tighten.co)** -- **[WebReinvent](https://webreinvent.com/)** -- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** -- **[64 Robots](https://64robots.com)** -- **[Curotec](https://www.curotec.com/services/technologies/laravel/)** -- **[Cyber-Duck](https://cyber-duck.co.uk)** -- **[DevSquad](https://devsquad.com/hire-laravel-developers)** -- **[Jump24](https://jump24.co.uk)** -- **[Redberry](https://redberry.international/laravel/)** -- **[Active Logic](https://activelogic.com)** -- **[byte5](https://byte5.de)** -- **[OP.GG](https://op.gg)** - -## Contributing - -Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). - -## Code of Conduct - -In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). - -## Security Vulnerabilities - -If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. - -## License - -The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). +``` +git clone https://github.com/naquad/laravel-bug-report-49890.git +cd laravel-bug-report-49890 +cp .env.example .env +./artisan migrate +./artisan app:poc +``` diff --git a/app/Console/Commands/PocCommand.php b/app/Console/Commands/PocCommand.php new file mode 100644 index 0000000..7436b8a --- /dev/null +++ b/app/Console/Commands/PocCommand.php @@ -0,0 +1,49 @@ + 'test']); + + ProcessRecord::dispatch($r); + $r->delete(); + Artisan::call('queue:work', ['--once' => true]); + + $keys = Redis::keys('*'); + if (!$keys) { + $this->info('No keys found in Redis, lock removed'); + } else { + $this->error('Keys found in Redis, lock not removed'); + dump($keys); + } + } +} diff --git a/app/Jobs/ProcessRecord.php b/app/Jobs/ProcessRecord.php new file mode 100644 index 0000000..3a8ff37 --- /dev/null +++ b/app/Jobs/ProcessRecord.php @@ -0,0 +1,34 @@ +id(); + $table->string('name')->unique(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('records'); + } +};