phpkiteconnect icon indicating copy to clipboard operation
phpkiteconnect copied to clipboard

Incompatible with PHP 7.3

Open VarunAgw opened this issue 3 years ago • 12 comments

Please test it thoroughly before publishing it to production.

https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.mixed

The feature is introduced in PHP 8.0, yet it's used widely in the code.

Example error: ( ! ) Fatal error: Uncaught TypeError: Return value of KiteConnect\KiteConnect::getPositions() must be an instance of KiteConnect\mixed, instance of stdClass returned in D:\www\trading\vendor\zerodha\phpkiteconnect\src\KiteConnect.php on line 648

There might be more issues with PHP 7.3. Please test it thoroughly with PHP 7.3.

VarunAgw avatar Apr 10 '21 17:04 VarunAgw

@ranjanrak Can you take a look at this?

vividvilla avatar Apr 11 '21 06:04 vividvilla

@VarunAgw The issue seems to be at Composer file, as it has captured the minimum required PHP version as 7.3. Checking on this composer file issue. We have thoroughly tested this on our local setup including running the added unit tests. Our local setup has PHP 8.0.3. Mostly, we will update the package with the minimum requirement of PHP >=8. For the older PHP version, users can always refer to our older version, as stated in README.

ranjanrak avatar Apr 12 '21 05:04 ranjanrak

thissssssss

VarunAgw avatar Apr 12 '21 10:04 VarunAgw

Besides, it's terrible to force people to use PHP 8.0 which was released just 4 months ago.

You have to understand that people run multiple projects other than Zerodha PHP SDK on their development/production machine.

PHP 8 has breaking changes. By upgrading Zerodha SDK, I am not going to break all my other projects whose dependencies are not compatible with PHP 8 yet. You have to give the entire PHP eco-system time to upgrade before forcing such latest standards.

VarunAgw avatar Apr 12 '21 10:04 VarunAgw

@VarunAgw

PHP 8 has breaking changes. By upgrading Zerodha SDK, I am not going to break all my other projects whose dependencies are not compatible with PHP 8 yet. You have to give the entire PHP eco-system time to upgrade before forcing such latest standards.

Thanks for your input. We are re-evaluating our PHP version compatibility for the recent release.

ranjanrak avatar Apr 12 '21 13:04 ranjanrak

Return type (used in getPositions and getMargins) mixed is not implemented in php7.3 yet. It's in php8.

VishalKumarSahu avatar Jul 25 '21 21:07 VishalKumarSahu

getLTP function also is not working in > 7.3. Can you please fix it?

sathyamoorthi avatar Dec 16 '21 06:12 sathyamoorthi

You need to upgrade to PHP > 8.0 for now.

ranjanrak avatar Dec 16 '21 11:12 ranjanrak

KiteConnect.zip

Here is the PHP 7.3 fixed I made 6 months ago. Feel free to compare it with master before using it.

VarunAgw avatar Dec 16 '21 12:12 VarunAgw

@ranjanrak But in "Requirements" section you mentioned 7.3 or greater !!? At least you should update README.

Thanks @VarunAgw

sathyamoorthi avatar Dec 16 '21 12:12 sathyamoorthi

@sathyamoorthi Don't expect too much here. Typical Indian companies attitude.

VarunAgw avatar Dec 16 '21 12:12 VarunAgw

KiteConnect.zip

Here is the PHP 7.3 fixed I made 6 months ago. Feel free to compare it with master before using it.

Not compatible, still same exception throwing,

vishalmote avatar Apr 09 '22 07:04 vishalmote