Skip to content

Expired view cache check causing issues with my deployment script #53364

@jlswanson28694

Description

@jlswanson28694

Laravel Version

10.48.22

PHP Version

8.1.2

Database Driver & Version

No response

Description

I use a simple deployment bash script that runs git pull followed by some cache commands, including php artisan view:cache. This can often result in the last modified timestamp of a Blade file having the same timestamp as its corresponding compiled view. Laravel's view compiler uses a >= comparison when checking if the compiled view is expired, which means all the views compiled in my deployment script aren't being used. Is there a reason why it can't use a > comparison instead?

https://github.com/laravel/framework/blob/11.x/src/Illuminate/View/Compilers/Compiler.php#L112

Steps To Reproduce

  • Use a bash script to pull changes from a git repo that modify a Blade file. In the same bash script, run php artisan view:cache.
  • Use Illuminate\Filesystem\Filesystem::lastModified to check the timestamp of the modified Blade file and compare it to the timestamp of any compiled view. You will see they are the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions