0

When running composer install in production I get a new error message today:

$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Error

  Call to undefined function Symfony\Component\Console\Input\escapeshellarg()

  at vendor/symfony/console/Input/Input.php:195
    191▕      * @return string
    192▕      */
    193▕     public function escapeToken(string $token)
    194▕     {
  ➜ 195▕         return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
    196▕     }
    197▕
    198▕     /**
    199▕      * {@inheritdoc}

      +1 vendor frames
  2   [internal]:0
      Symfony\Component\Console\Input\ArgvInput::Symfony\Component\Console\Input\{closure}("package:discover")

      +8 vendor frames
  11  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

I can't figure out what is wrong. I'm wondering if the dependencies have got into a funny state and I need to do a fresh install of the vendor directory?

5
  • Out of curiosity: could you check whether running escapeshellarg in one of your own scripts works properly?
    – Nico Haase
    Apr 28, 2022 at 11:02
  • Tested it, but doesn't work in production... (it does work in development though). $ php artisan tinker >>> escapeshellarg('') PHP Error: Call to undefined function escapeshellarg() in Psy Shell code on line 1 >>>
    – Mr U.
    Apr 29, 2022 at 18:04
  • It should just be a standard PHP function... php.net/manual/en/function.escapeshellarg.php But it's gone walkies...
    – Mr U.
    Apr 29, 2022 at 18:11
  • 1
    I suspect that the function has been disabled in WHM... PHP-FPM settings... Just trying to get this sorted with the host.
    – Mr U.
    Apr 29, 2022 at 19:08
  • 1
    If you cannot run that function in your own script, talk to the support of your webhoster about this problem
    – Nico Haase
    Apr 30, 2022 at 7:00

1 Answer 1

3

Turns out the function escapeshellarg() was disabled by the hosting provider. Thank you Nico for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.