pgrimaud / instagram-user-feed

This is a scrapper to easily fetch any feed and interact with Instagram (like, follow, etc.) without OAuth for PHP.
MIT License
881 stars 137 forks source link

Fatal Error Uncaught TypeError: Argument 1 passed to Instagram\Api:: #111

Closed filippodicostanzo closed 4 years ago

filippodicostanzo commented 4 years ago

Version(s) affected: 6.3.1

Description
Fatal error: Uncaught TypeError: Argument 1 passed to Instagram\Api::__construct() must be an instance of Instagram\Storage\CacheManager, instance of Symfony\Component\Cache\Adapter\FilesystemAdapter given, called in Y:\php.localidautore.it\instagram-user-feed\index.php on line 29 and defined in Y:\php.localidautore.it\instagram-user-feed\vendor\pgrimaud\instagram-user-feed\src\Instagram\Api.php:44

How to reproduce

use Instagram\Api;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;

$cachePool = new FilesystemAdapter('Instagram', 0, __DIR__ . '/../cache');
$api = new Api($cachePool);
$api->login('username', 'password'); // mandatory
$profile = $api->getProfile('robertdowneyjr');

echo $profile->getUserName(); // robertdowneyjr
echo $profile->getFullName(); // Robert Downey Jr. Official
pgrimaud commented 4 years ago

Hello @filippodicostanzo

This error Fatal error: Uncaught TypeError: Argument 1 passed to Instagram\Api::__construct() must be an instance of Instagram\Storage\CacheManager seems to be linked to old library ^5.x.

https://github.com/pgrimaud/instagram-user-feed/blob/5.6/src/Instagram/Api.php#L44

Could you :

😄

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

hosseind600 commented 3 years ago

Fatal error: Uncaught TypeError: Argument 1 passed to Instagram\Api::construct() must be an instance of Instagram\Storage\CacheManager or null, instance of Symfony\Component\Cache\Adapter\FilesystemAdapter given, called in C:\xamppp\htdocs\test.php on line 16 and defined in C:\xamppp\htdocs\vendor\pgrimaud\instagram-user-feed\src\Instagram\Api.php:44 Stack trace: #0 C:\xamppp\htdocs\test.php(16): Instagram\Api->construct(Object(Symfony\Component\Cache\Adapter\FilesystemAdapter)) #1 {main} thrown in C:\xamppp\htdocs\vendor\pgrimaud\instagram-user-feed\src\Instagram\Api.php on line 44

test.php `

declare(strict_types=1);

use Instagram\Api; use Instagram\Exception\InstagramException;

use Instagram\Model\User; use Psr\Cache\CacheException; use Symfony\Component\Cache\Adapter\FilesystemAdapter;

require './vendor/autoload.php';

$cachePool = new FilesystemAdapter('Instagram', 0, './cache');

try { $api = new Api($cachePool); $api->login("xxx", "cccc"); ... ... ... `