Laravel 5.1 Net_SFTP has a deprecated constructor - php

I'm using Laravel 5.1 with the package laravelcollective/remote to run an SSH command on a remote server:
\SSH::into('myserver')->run($commands);
But I'm getting the following error message:
Methods with the same name as their class will not be constructors in a future version of PHP; Net_SFTP has a deprecated constructor
I can see that the error is coming from phpseclib package, and on newer versions they have fixed that. (They changed the function name to __construct), but I can't update phpseclib package because I don't include it on my composer.json file, laravelcollective/remote does this.
How can I solve this?

You cannot and should not solve this as it has already been fixed as you correctly stated.
The warnning about the deprecated construtor method is only a warning/info. This does not influence your application. As soon as laravellcollective include the newer version of phpseclib in their composer.json this warning will disappear. Of course you need the check from time to time and update your application with a composer update.

Related

Symfony CLI does not use the correct PHP version when running the "new" command

I have setup my environment as follows: Wamp 3 with PHP7.1.33 version, composer 2 and the Symfony binary.
But when I try to run symfony new my_project_name --version=4.4 --full I get this error:
Creating a "symfony/website-skeleton" project at "./my_project_name"
Your version of PHP, 5.4.12, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.
[InvalidArgumentException]
Could not find package symfony/website-skeleton with version 4.4.* in a version installable using your PHP version,
PHP extensions and Composer version.
As mentionned in the error, PHP 5.4.12 is used, but when I run php --version I get 7.1.33 version.
I haven't used either WAMP or the Symfony binary, but on the documentation it says:
If you have multiple PHP versions installed on your computer, you can tell Symfony which one to use creating a file called .php-version at the project root directory
If you have multiple PHP versions installed, apparently the tool attempts to find them and list them if you use the symfony local:php:list command. No idea how it works or how reliable it is, but should tell you if it's able to detect your PHP 7 runtime.
More importantly, despite the poor advice on Symfony part, you do not really need to use the symfony binary to create a project. The binary simply calls composer, so why not call composer directly? That way you can be sure you are using the PHP and Composer's versions you want and expect, instead of relying on an intermediary.
Just do:
composer create-project symfony/website-skeleton your-project-name ^4.4
(this is what you get by using the --full flag, if you do not use it you simply install symfony/skeleton, which includes less components out of the box).
As an aside, naming the binary symfony was a really poor choice on Symfony's part, as it makes it almost impossible to search for issues related to the tool and not the framework. Or to suggest to use the binary instead of using composer directly, adding a layer of opacity for many users.

Laravel passport 7.5.1 - Replicating claims

We are having a new error related with laravel/passport: 7.5.1. Today, this library has been working as the last week. But this stops showing this message via Postman:
Replicating claims as headers is deprecated and will removed from v4.0. Please manually set the header if you need it replicated.
Do someone knows something about this issue?
We don't know how to continue with this...
We're using Laravel 5.7 (we know that...)
We "solved" this temporally downgrading the library lcobucci/jwt from 3.4.0 to 3.3.3.
help me in laravel 5.8
set in composer.json
"laravel/passport": "^7.5",
"lcobucci/jwt": "3.3.2",
and update vendor
composer update
For me downgrading, lcobucci/jwt worked for me. I was currently using 3.4.* but downgraded it to a constant 3.3.3
to downgrade I run the command
composer require lcobucci/jwt 3.3.3
And that was it. But my only concern is I am not certain if this is a temporary or a permanent solution to this issue. But at least it will reboot things up if your system failed cause of that error

How to have eclipse resolve php classes in MongoDB\BSON namespace?

After many comes and goes I managed to install the MongoDB Driver for PHP 5.6 and made it work on OSX El Capitan. (The way it worked was using Homebrew)
To start working on a project I created the folder for the project and using Composer installed the required packages I needed. Between theese packages I required mongodb/mongodb which is the recomended mongo php library to use by the php Manual on line and in the driver github page.
The problem I found is that Eclipse is resolving the classes in the \MongoDB\ namespace but not in the \MongoDB\BSON\ namespace. If I check what Composer installed in the vendor folder I am able to see that the \MongoDB\BSON\ classes in fact are missing. On the other hand if I run the program in the PHP included webserver, it executes as expected.
So my question is how can do or what am I missing for Eclipse to find the missing classes. Are they defined somewhere else?
If this is not possible because they are compiled into a binary library and I have no way to resolve them, Is there any way to have Eclipse not showing these particular classes as mistakes?
Example of class that runs ok in the webserver, but is highlighted as an error in Eclipse:
$fecha_creacion = new MongoDB\BSON\UTCDateTime();
Reading this post and not finding anything newer on the subject I arrived to the conclusion that developers of the driver don't provide the php sources and leave it to the IDE developers to provide STUBs for the different fuctions of the driver in a way the IDE can recognize the functions and provide syntax checking and documentations popups.
Following this question, I finally ended up finding a JetBrains GitHub where there are many different stubs for PHPStrom, this one among them.
So I copied the file and added it to my project as part of the sources. And that solved my problem.

Laravel - Problems with updating to Laravel 5.4. Way module share() error

This is regarding Laravel and I am still pretty new to the framework. I recently updated my Laravel to 5.4. And I am running into the following error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Illuminate\Foundation\Application::share()
Some investigation landed me on one of my vendor module 'Way' is still call share(), which is no longer supported. I did realize that singleton() is the preferred way, but should I even touch the vendor files? Should composer update the vendor Modules as well (especially Way since it is one of the core module)?
Any tips will be greatly appreciated!
Thanks.
laravel 5.4 share has been removed. You will have to use the singleton instead.
See this
https://github.com/laravel/framework/commit/1a1969b6e6f793c3b2a479362641487ee9cbf736
I was able to fix it for now by adjusting the way generator line in composer.json to:
"way/generators": "dev-master"
The library was updated but it is just not included in the composer update.
Just want to post the answer here in case anyone is running into similar issue.
This library does not have support for Laravel 5.4 .
Author referred other library : laracasts/generators. Both the packages are managed by same author.
Check below link : https://github.com/JeffreyWay/Laravel-4-Generators#laravel-5

PHPUnit tests failing in 7.1 and HHVM but not 7.0 or 5.6

My project runs just fine using PHP 5.6, 7.0, 7.1 (I haven't tried running it using nightly or HHVM), it's just my tests that all fail when using PHP 7.1, nightly, and HHVM. My tests run successfully using PHP 5.6 and 7.0. They were working fine, until I switched to using Composer for one of my components and it caused my directory structure to be adjusted a bit. But given that it works just fine in some PHP versions, and not others, I don't think I have a simple "typo" per se. Is this a potential issue with PHP 7.1? I looked at change logs between PHP 7.0 and 7.1 to see if something stood out about how namespaces or autoloading, but I didn't see anything.
I'm using Travis CI to build my project and run my tests. The results I'm trying to debug can be found here: https://travis-ci.org/dbudwin/RoboHome-Web/jobs/173488168
They all result in the same error of not being able to find classes, for instance:
1) Tests\Models\DevicesModelTest::testAdd
Error: Class 'Models\DevicesModel' not found
Here is a direct link to my pull request that needs work: https://github.com/dbudwin/RoboHome-Web/pull/45
In the composer.json on the branch F3Composer you missing to update the psr-4 of the autoload section. You refactor the path of the class but don't update the autoload. so change your autoload as follow:
composer.json
"autoload": {
"psr-4": {
"Models\\":"app/models",
"Controllers\\":"app/controllers"
}
},
rerun the composer install (that regenerate the autoloader files) and the test suite will go green.
Hope this help

Categories