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
Related
After upgrading to PHP 7.4, elemntor started giving error
url: www.aldon.ltd/
Cloud Service: GCP
Server: Openlitespeed Wordpress
Linux: Ubuntu 20.04 LTS
Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1449
Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1451
Except this notice shown at the top of webpage, all other functions are working as expected.
Code causing error
/**
* End controls section.
*
* Used to close an existing open controls section. When you use this method
* it stops adding new controls to this section.
*
* This method should be used inside _register_controls().
*
* #since 1.4.0
* #access public
*/
Public function end_controls_section() {
$stack_name = $this->get_name();
// Save the current section for the action.
$current_section = $this->current_section;
$section_id = $current_section['section'];
$args = [
'tab' => $current_section['tab'],
];
Error Log at /usr/local/lsws/logs/error.log
PHP Notice: wp_deregister_script was called incorrectorrectly. Do not deregister the jquery-core script in the administration area. To target the front-end theme, use the wp_enqueue_scrip>
PHP Notice: /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1449
PHP Notice: /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1451
I resolved it for a temporary solution. Changing line no. 1204 from
if ( $dynamic_property ) ) {
to
if ( $dynamic_property && isset($settings[ $control_name ][ $dynamic_property ]) ) {
Directory structure:
module_name -> config -> install -> rest.resource.location_api.yml
id: location_api
plugin_id: location_api
granularity: resource
configuration:
methods:
- GET
- POST
- PATCH
- DELETE
formats:
- json
authentication:
- cookie
module_name/src/plugin/rest/resource/LocationApi.php
<?php
namespace Drupal\locations\Plugin\rest\resource;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Drupal\Core\Controller\ControllerBase;
//use Drupal\node\Entity\Node;
//use Drupal\taxonomy\Entity\Term;
use Drupal\user\Entity\User;
//use Drupal\Core\Database\Connection;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
* Provides a KDR's Rest Custom Resource For Locations
*
* #RestResource(
* id = "location_api",
* label = #Translation("KDR's Rest Custom Resource For Location"),
* uri_paths = {
* "canonical" = "/kdr-apis/v1.0/location/{sl_id}",
* "https://www.drupal.org/link-relations/create" = "/kdr-apis/v1.0/location"
* }
* )
*/
class LocationApi extends ResourceBase {
}
but when I install the module, then it returns an error,
Message
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity_bundle:node" plugin does not exist. Valid plugin IDs for Drupal\Core\Condition\ConditionManager are: node_type, request_path, current_theme, user_role in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /home/linuxdem/kdr.linuxdemos.me/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
This was the Drupal 8 cache issue, I have resolved by clearing cache and re-installing module.
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
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
I have searched and found i have been lost all day now, and I feel I am going round in circles.
I have written, (with help of a few guides), a simple API for my Yii based application.
I have now come to document this API for other to use it.
I read everywhere that Swagger seems to be the way to go to implement, API documentation.
However I can seem to get anywhere on how to use this application
I have followed the instructions on Swagger PHP
Now I am lost has anyone got any examples of what to do next.
I have tried doing some self annotations of my ApiController.php and this doesnt work. I have been trying using the swagger.phar command line, but I still get no where.
I know you will need a lot more information but i dont know what bits of info you need so rather than pasting lots of useless information please ask and i will send anything you need.
To be honest all i would like is some simple API documentation but it just seems impossible.
Cheers
I have implemented swagger-php in my project. Please follow the below suggested instructions :
1) Download swagger-php(github.com/zircote/swagger-php) and swagger-ui(github.com/wordnik/swagger-ui). Extract them to your workspace.
2) Create a folder called swagger-api and blank php file called index.php in you workspace and paste the following code.
<?php
use Swagger\Annotations as SWG;
/**
* #SWG\Resource(
* apiVersion="0.2",
* swaggerVersion="1.2",
* resourcePath="/api.php",
* basePath="http://localhost/swagger-api/"
* )
*/
// Run this in url
// localhost/index.php?action=get_app_list
// This is the API,show the list in array
/**
*
* #SWG\Api(
* path="/api.php?action=get_app_list",
* description="Operations about get app list",
* produces="['application/json']",
* #SWG\Operations(
* #SWG\Operation(
* method="GET",
* summary="Find facet by ID",
* notes="Returns a facet based on ID",
* type="ListResult",
* nickname="getAllResults",
* #SWG\ResponseMessages(
* #SWG\ResponseMessage(
* code=400,
* message="Invalid ID supplied"
* ),
* #SWG\ResponseMessage(
* code=404,
* message="facet not found"
* )
* )
* )
* )
* )
*/
function get_app_list()
{
//normally this info would be pulled from a database.
//build JSON array
$app_list = array(array("id" => 1, "name" => "Web Demo"),
array("id" => 2, "name" => "Audio Countdown"),
array("id" => 3, "name" => "The Tab Key"), array("id" => 4,
"name" => "Music Sleep Timer"));
return $app_list;
}
$possible_url = array("get_app_list");
$value = "An error has occurred";
if (isset($_GET["action"]) && in_array($_GET["action"], $possible_url))
{
switch ($_GET["action"])
{
case "get_app_list":
$value = get_app_list();
break;
$value = "Missing argument";
break;
}
}
//return JSON array
echo(json_encode($value));
?>
3) Create a folder named swagger-docs in workspace.
4) Open you terminal and go the location of swagger-php in you workspace(i.e cd workpace/swagger-php).
5) Execute the following in your terminal
php swagger.phar /workspace/swagger-api -o /workspace/swagger-docs (This can be executed where we contain swagger.phar file).
6) You will see some files created on your swagger docs folder.
7) Open index.html in swagger-ui/dist/
8) Replace -: url: "http://petstore.swagger.wordnik.com/api/api-docs" to url: "http:localhost/swagger-docs"
9) Run localhost/swagger-ui/dist in your browser.