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

Undefined constant "Spatie\Backup\Commands\SIGINT" #1288

Closed
TylerVigario opened this issue Apr 12, 2021 · 10 comments
Closed

Undefined constant "Spatie\Backup\Commands\SIGINT" #1288

TylerVigario opened this issue Apr 12, 2021 · 10 comments

Comments

@TylerVigario
Copy link
Contributor

TylerVigario commented Apr 12, 2021

Since 7.3.4 I get this error in the console from composer install/update and any artisan commands.

  Undefined constant "Spatie\Backup\Commands\SIGINT"

  at C:\inetpub\wwwroot\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php:877
    873▕         }
    874▕
    875▕         array_pop($this->buildStack);
    876▕
  ➜ 877▕         return $reflector->newInstanceArgs($instances);
    878▕     }
    879▕
    880▕     /**
    881▕      * Resolve all of the dependencies from the ReflectionParameters.

  1   C:\inetpub\wwwroot\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php:877
      ReflectionClass::newInstanceArgs()

  2   C:\inetpub\wwwroot\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php:714
      Illuminate\Container\Container::build()

I reverted to 7.3.3, and it worked, so I think it may be an issue or conflict.

IIS
PHP 8.0.3
laravel/framework 8.36.2
spatie/laravel-backup 7.4

Edit: This may be because of my Windows (development) environment. PCNTL does not work on Windows and is a requirement from the new upstream spatie/laravel-signal-aware-command.

@krismanning
Copy link

krismanning commented Apr 14, 2021

I have the same issue after upgrading. I'm also running a windows dev environment. I see that Laravel Backup doesnt support windows servers but I'm hopeful theres a fix that allows me to continue using windows to develop even if it can't ultimately take a backup.

Apache (XAMPP)
PHP 8.0.3
laravel/framework 8.36.2
spatie/laravel-backup 7.4

@HDVinnie
Copy link

Same here

@eliasjtg
Copy link

image

@freekmurze
Copy link
Member

This particular error is caused by SIGINT not being available on Windows. I'd accept a PR that adds a check for windows to avoid that particular piece of code.

If the fix is not too ugly, I'll consider merging it in 👍

@ruslansteiger
Copy link

ruslansteiger commented Apr 16, 2021

I have encountered the same problem on my forge machine (linux). It happens when I use the Artisan-Facade to call any command.

Reproduction:

  1. Add a route to your web.php-file:
use App\Console\Commands\MyCommand;
use Illuminate\Support\Facades\Artisan;

Route::get('/reproduction', function () {
    Artisan::call(MyCommand::class);

    return '👀';
});
  1. Visit /reproduction with your browser.

  2. Following exception is thrown:
    Undefined constant "Spatie\Backup\Commands\SIGINT"


OS: Ubuntu 20.04.2 LTS
PHP: v8.0.3
Webserver: nginx/1.18.0
Laravel: v8.37.0
spatie/laravel-backup: v7.5.1

@fibis
Copy link

fibis commented Apr 29, 2021

Having also the same problem in our CI, running composer in the composer:2 docker container.

@fibis
Copy link

fibis commented May 3, 2021

For those who got the same error, since linux php alpine image doesn't have the pcntl package installed: Run docker-php-ext-install pcntl to install this package. @freekmurze it would be cool if there was a check for that.

@freekmurze
Copy link
Member

Feel free to PR improvements!

@pedami
Copy link

pedami commented Aug 13, 2022

Hola, yo tengo el mismo problema, la extensión está instalada correctamente y el entorno está en producción con la última versión de Laravel Nova:

[2022-08-13 04:12:13] local.ERROR: Undefined constant "Spatie\Backup\Tasks\Backup\SIGINT" {"userId":1,"exception":"[object] (Error(code: 0): Undefined constant "Spatie\Backup\Tasks\Backup\SIGINT" at /home/*************************/public_html/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php:148)

Gracias.

@elmarzouguidev
Copy link

I fixed this issue by disabling Signals

$backupJob = BackupJobFactory::createFromArray(config('backup'));

$backupJob->disableSignals();
$backupJob->run();

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

9 participants