[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined method Illuminate\Foundation\Console\ClosureCommand::setHidden()
I was serching the files and this method exist in parent class! I put this little thing in constructor what is going on:
use Symfony\Component\Console\Command\Command as SymfonyCommand;
class Command extends SymfonyCommand
{
public function __construct()
{
$r1 = new \ReflectionClass($this);
$r2 = new \ReflectionClass(SymfonyCommand::class);
var_dump([$r1->getFileName(), $r2->getFileName()]);
}
// rest of class
}
Result: composer autoload own, older Command.php instead of this from project.
array(2) {
[0]=>
string(91) "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClosureCommand.php"
[1]=>
string(67) "phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php"
}
I would like to know why symfony class is not loaded from project but from some magic place and how I can fix that.
Additional info:
Dockerfile for php that add composer:
# Composer
ENV PATH "/composer/vendor/bin:$PATH"
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /composer
ENV COMPOSER_VERSION 1.4.2
RUN curl -s -f -L -o /tmp/composer-setup.php https://getcomposer.org/installer
RUN curl -s -f -L -o /tmp/composer-setup.sig https://composer.github.io/installer.sig
RUN php -r " \
\$signature_php = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \
\$signature_sig = trim(file_get_contents('/tmp/composer-setup.sig')); \
echo ' SIGNATURE PHP: [' . \$signature_php . \"]\\n\"; \
echo ' SIGNATURE SIG: [' . \$signature_sig . \"]\\n\"; \
if (\$signature_php !== \$signature_sig) { \
unlink('/tmp/composer-setup.php'); \
echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
exit(1); \
}"
RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin cd --filename=composer --version=${COMPOSER_VERSION} \
&& rm /tmp/composer-setup.php \
&& composer --ansi --version --no-interaction
Composer part:
"post-update-cmd": [
"Modules\\Core\\Composer\\ComposerScripts::postUpdate",
"php artisan vendor:publish --tag=public --force",
"php artisan optimize"
],
答案 0 :(得分:1)
Maybe the signature for obtain composer is not matching, you have to know that signature can change, if you want to obtain the last one use this url https://composer.github.io/installer.sig
Use this snippet for verify signature.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$(wget -q -O - https://composer.github.io/installer.sig)') { \
echo 'Installer good'; \
} else { \
echo 'Installer corrupt'; die; \
} echo PHP_EOL;"
答案 1 :(得分:1)
我认为运行composer self-update
命令也会更新作曲家的签名。如果你有ssh访问服务器,我建议尝试以下方法:
composer.lock
。vendor
文件夹。composer install
这应解决您提到的所有问题。
答案 2 :(得分:1)
这是我安装作曲家的方式(Alpine,php7.1-fpm,自编nginx)
EXPECTED_COMPOSER_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) && \
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '${EXPECTED_COMPOSER_SIGNATURE}') { echo 'Composer.phar Installer verified'; } else { echo 'Composer.phar Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php --install-dir=/usr/bin --filename=composer && \
php -r "unlink('composer-setup.php');"
并尝试将安装后更改为此(laravel 5.5,dockerized and smooth running)
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
.....