NunoMaduro/Collision fatal error on php artisan:make migration - php

When I run the command php artisan:make migration, I have this error :
PHP Fatal error: Declaration of NunoMaduro\Collision\Writer::write(Whoops\Exception\Inspector $inspector): NunoMaduro\Collision\void must be compatible with NunoMaduro\Collision\Contracts\Writer::write(Whoops\Exception\Inspector $inspector): NunoMaduro\Collision\Contracts\void in /home/gregory/folbet/vendor/nunomaduro/collision/src/Writer.php on line 27
Symfony\Component\Debug\Exception\FatalErrorException : Declaration of NunoMaduro\Collision\Writer::write(Whoops\Exception\Inspector $inspector): NunoMaduro\Collision\void must be compatible with NunoMaduro\Collision\Contracts\Writer::write(Whoops\Exception\Inspector $inspector): NunoMaduro\Collision\Contracts\void
at /home/gregory/folbet/vendor/nunomaduro/collision/src/Writer.php:27 23| * This is an Collision Writer implementation.
24| * 25| * #author Nuno Maduro <enunomaduro#gmail.com>
26| */ > 27| class Writer implements WriterContract 28| {
29| /** 30| * The number of frames if no verbosity is specified. 31| */
PHP Fatal error: Uncaught TypeError: Return value of NunoMaduro\Collision\Writer::write() must be an instance of NunoMaduro\Collision\void, none returned in /home/gregory/folbet/vendor/nunomaduro/collision/src/Writer.php:114
Stack trace:
#0 /home/gregory/folbet/vendor/nunomaduro/collision/src/Handler.php(48): NunoMaduro\Collision\Writer->write(Object(NunoMaduro\Collision\Adapters\Laravel\Inspector))
#1 /home/gregory/folbet/vendor/nunomaduro/collision/src/Adapters/Laravel/ExceptionHandler.php(86): NunoMaduro\Collision\Handler->handle()
#2 /home/gregory/folbet/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(101): NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler->renderForConsole(Object(Symfony\Component\Console\Output\ConsoleOutput), Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 /home/gregory/folbet/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(87): Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole(Object(Symfony\Com in /home/gregory/folbet/vendor/nunomaduro/collision/src/Writer.php on line 114
How can I fix it ?
My Laravel version is 5.6.* and my PHP version is ^7.1.3

Related

Parse error: parse error, expecting `'{'' Laravel

I ran php artisan route:list in eclipse folder of a laravel project and got this error. I have checked the file and there is { there.
$ php artisan route:list
Warning: Unsupported declare 'strict_types' in
/Users/frankukachukwu/eclipse-workspace/essenceglobalmart.net/ap
p/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php
on line 8
Parse error: parse error, expecting `'{'' in
/Users/frankukachukwu/eclipse-workspace/essenceglobalmart.net/app/
vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php
on line 19
<?php
/**
* #see https://github.com/zendframework/zend-diactoros for the canonical source repository
* #copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
* #license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
*/
declare(strict_types=1);
namespace Zend\Diactoros;
/**
* Create an uploaded file instance from an array of values.
*
* #param array $spec A single $_FILES entry.
* #throws Exception\InvalidArgumentException if one or more of the tmp_name,
* size, or error keys are missing from $spec.
*/
function createUploadedFile(array $spec) : UploadedFile {
if (! isset($spec['tmp_name'])
|| ! isset($spec['size'])
|| ! isset($spec['error'])
) {
throw new Exception\InvalidArgumentException(sprintf(
'$spec provided to %s MUST contain each of the keys "tmp_name",'
. ' "size", and "error"; one or more were missing',
__FUNCTION__
));
}
return new UploadedFile(
$spec['tmp_name'],
$spec['size'],
$spec['error'],
isset($spec['name']) ? $spec['name'] : null,
isset($spec['type']) ? $spec['type'] : null
);
}
It seems the package that you are using is not compatible with your PHP version
You need a compatible PHP version, which is 7.0.0 - 7.0.5 || ^7.0.7.
To solve this issue you can either update your PHP version or downgrade package

can't add product to sylius-db from command

protected function execute(InputInterface $input, OutputInterface $output)
{
$factory = $this->getContainer()->get('sylius.factory.product');
$manager = $this->getContainer()->get('sylius.manager.product');
$product = $factory->createNew();
$product
->setName('Foo')
->setDescription('Nice product');
$manager->persist($product);
$manager->flush(); // Save changes in database.
So I want to add a product from a command. But I'm always getting this Error:
PHP Fatal error: Call to a member function setDescription() on null in C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\src\AppBundle\Command\Collmex\ImportProductsFromCollmexCommand.php on line 46
PHP Stack trace:
PHP 1. {main}() C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\bin\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\bin\console:28
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:130
PHP 4. Symfony\Component\Console\Application->doRun() C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:81
PHP 5. Symfony\Component\Console\Application->doRunCommand() C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:223
PHP 6. Symfony\Component\Console\Command\Command->run() C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:887
PHP 7. AppBundle\Command\Collmex\ImportProductsFromCollmexCommand->execute() C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:264
Fatal error: Call to a member function setDescription() on null in C:\Users\Coffee-Bike\IntelliJIDEAProjects\sylius-shop\acme\src\AppBundle\Command\Collmex\ImportProductsFromCollmexCommand.php on line 46
But I'm juts following this documentation here.
And this is the same procedure. What am I doing wrong?
Check the docs in The Book section here: http://docs.sylius.org/en/latest/book/products/products.html

Amazon S3 and Yii2

I created a code to use Amazon S3 using this composer component:
https://github.com/2amigos/yii2-resource-manager-component
This worked very well.
But I changed my server and when I upload a image to Amazon S3 I received this error:
PHP Fatal Error – yii\base\ErrorException
Class 'Aws\S3\Enum\CannedAcl' not found
I did not change anything of code, I dont understand why this error, I cant find a solution
How can I fix it?
This is the complete error :
PHP Fatal Error – yii\base\ErrorException
Class 'Aws\S3\Enum\CannedAcl' not found
1. in /opt/app-root/src/admapps/vendor/2amigos/yii2-resource-manager-component/AmazonS3ResourceManager.php at line 78
69707172737475767778798081828384858687 * #return \Guzzle\Service\Resource\Model
*/
public function save($file, $name, $options = [])
{
$options = ArrayHelper::merge([
'Bucket' => $this->bucket,
'Key' => $name,
'SourceFile' => $file->tempName,
'ACL' => CannedAcl::PUBLIC_READ // default to ACL public read
], $options);
$this->getClient()->putObject($options);
}
/**
* Removes a file
* #param string $name the name of the file to remove
* #return boolean
*/
2. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/InlineAction.php at line 55 – app\controllers\BeersController::actionUploadlogobeer()
3. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/InlineAction.php at line 55 – call_user_func_array:{/opt/app-root/src/admapps/vendor/yiisoft/yii2/base/InlineAction.php:55}()
4. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/Controller.php at line 154 – yii\base\InlineAction::runWithParams()
5. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/Module.php at line 454 – yii\base\Controller::runAction()
6. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/web/Application.php at line 87 – yii\base\Module::runAction()
7. in /opt/app-root/src/admapps/vendor/yiisoft/yii2/base/Application.php at line 375 – yii\web\Application::handleRequest()
8. in /opt/app-root/src/admapps/web/index.php at line 13 – yii\base\Application::run()
78910111213require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../helpers/Utils.php');
$config = require(__DIR__ . '/../config/web.php');
(new yii\web\Application($config))->run();
Posted by Bizley
This extension uses "aws/aws-sdk-php": "2.5.2" and it's very old (at GitHub version 3.18 is latest). AWS said they've removed CannedAcl in version 3 so it should not make impact on 2.5.2 (it is present in 2.5.2). Anyway there is the same issue reported about this github.com/2amigos/yii2-resource-manager-component/issues/10 – Bizley

Magento Fatal error: Call to a member function addLink() - Stack trace included

I just uninstalled 2 extension from magento connect and end up with a 3rd extension fatal error.
http://nutrija.com
Front end of magento is throwing just a white page.
backend - is working normally.
i have already tried disabling "Webinse_DailyDeals" extension, removing that 16th line of code. But no luck.
ERROR LOG: [Sun Mar 27 08:11:38 2016] [error] [client 59.96.113.41]
PHP Fatal error: Uncaught Error: Call to a member function addLink()
on null in
/home/nutrija/public_html/includes/src/Webinse_DailyDeals_Block_Links.php:16
Stack trace:
0 /home/nutrija/public_html/includes/src/__default.php(27948): Webinse_DailyDeals_Block_Links->addDealLink('dailydeals_link...')
1 /home/nutrija/public_html/includes/src/__default.php(27814): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
2 /home/nutrija/public_html/includes/src/__default.php(27806): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
3 /home/nutrija/public_html/includes/src/__default.php(27810): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
4 /home/nutrija/public_html/includes/src/__default.php(27810): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
5 /home/nutrija/public_html/includes/src/__default.php(13941): Mage_Core_Model_Layout->generateBlocks()
6 /home/nutrija/public in /home/nutrija/public_html/includes/src/Webinse_DailyDeals_Block_Links.php
on line 16
<?php
/**
* AddDealsLink Block
*
* #category Webinse
* #package Webinse_DailyDeals
* #author Webinse Team <info#webinse.com.com>
*/
class Webinse_DailyDeals_Block_Links extends Mage_Core_Block_Template
{
public function addDealLink()
{
$parentBlock = $this->getParentBlock();
$text = $this->helper('dailydeals')->getDealsConfig('dailydeals_group/label_deals_link');
$parentBlock->addLink($text, 'dailydeals/', $text, true, array(), 1, null, 'class="top-link-deals"');
return $this;
}
}
First, try to turn off compilation. Next, check why the $parentBlock not exists in your layout.

Add function with parameters in smarty variable

I'm a prestashop developper and i want to add my custom function using parameters in a smarty variable.
There's my PHP function
function maFonctionSMarty($params)
{
$array['1'] = $params['monParametre'];
$array['2'] = $params['monParametre1'];
return $array;
}
and in m'y template i try to do this
{$a|maFonctionSMarty:"toto":"tata"}
and i have an error.
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/Users/guillaume/Sites/prestashop_156/modules/wb_newsletter/admin_panel.tpl" on line 94 "{$a|maFonctionSMarty:"toto":"tata"}" unknown modifier "maFonctionSMarty"' in /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:667 Stack trace: #0 /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_compile_private_modifier.php(132): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown modifie...', 94) #1 /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(475): Smarty_Internal_Compile_Private_Modifier->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL) #2 /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(259): Smarty_Internal_TemplateCompilerBase->callTagCompil in /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 667
[PrestaShop] Fatal error in module smarty_internal_templatecompilerbase:
Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/Users/guillaume/Sites/prestashop_156/modules/wb_newsletter/admin_panel.tpl" on line 94 "{$a|maFonctionSMarty:"toto":"tata"}" unknown modifier "maFonctionSMarty"' in /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:667 Stack trace: #0 /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_compile_private_modifier.php(132): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown modifie...', 94) #1 /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(475): Smarty_Internal_Compile_Private_Modifier->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL) #2 /Users/guillaume/Sites/prestashop_156/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(259): Smarty_Internal_TemplateCompilerBase->callTagCompil
thanks
You have to put that function as a plugin in a separate file named modifier.maFonctionSMarty.php in tools/smarty/plugins. Also, the name of the function has to be different:
function smarty_modifier_maFonctionSMarty($params)

Categories