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
873 stars 136 forks source link

Instagram\Model\Media::toArray() specifies wrong property name #369

Open petertornstrand opened 8 months ago

petertornstrand commented 8 months ago

Version(s) affected: 7.0

Description

Instagram\Model\Media::toArray() specifies wrong property name:

'shortcode' => $this->shortCode

This produces an error:

Deprecated function: Creation of dynamic property Instagram\Model\Media::$shortcode is deprecated

How to reproduce

Serialize/unserialize an Media object.

Possible Solution

Fix key name in returned array.

'shortCode' => $this->shortCode

blackcatxhan commented 8 months ago

Version(s) affected: 7.0.0

I think same issue when I using Media sample from here https://github.com/pgrimaud/instagram-user-feed/blob/master/examples/media-detailed.php

Warning: Undefined property: stdClass::$items in Instagram/vendor/pgrimaud/instagram-user-feed/src/Instagram/Transport/JsonMediaDetailedDataFeed.php on line 23 Fatal error: Uncaught TypeError: current(): Argument #1 ($array) must be of type array, null given in Instagram/vendor/pgrimaud/instagram-user-feed/src/Instagram/Transport/JsonMediaDetailedDataFeed.php:23 Stack trace: #0 Instagram/vendor/pgrimaud/instagram-user-feed/src/Instagram/Transport/JsonMediaDetailedDataFeed.php(23): current(NULL) #1 Instagram/vendor/pgrimaud/instagram-user-feed/src/Instagram/Api.php(407): Instagram\Transport\JsonMediaDetailedDataFeed->fetchData(Object(Instagram\Model\Media)) #2 Instagram/media-download.php(24): Instagram\Api->getMediaDetailed(Object(Instagram\Model\Media)) #3 {main} thrown in Instagram/vendor/pgrimaud/instagram-user-feed/src/Instagram/Transport/JsonMediaDetailedDataFeed.php on line 23