chargebee / chargebee-php

PHP library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=php
MIT License
72 stars 62 forks source link

Problems with ListResult.php #41

Closed uuf6429 closed 2 years ago

uuf6429 commented 2 years ago

Let's take a look at ListResult.php.

Here are the key facts:

So from my understand:

foreach($result as $k => $v){
    echo "$k=$v"; // produces for example 0=somevalue
}

echo "0={$result[0]}"; // produces 0=null instead of 0=somevalue

As I see from lib/ChargeBee/Request.php:39, response originally contains items inside list index....so to sum this all up:

uuf6429 commented 2 years ago

By the way, a lot of code from that class can be removed if you make it extend \ArrayObject. Here's an example: https://3v4l.org/PvFLQ (works at least since PHP 5.4)

uuf6429 commented 2 years ago

Just realised, the offsetGet part of the problem mentioned above has been fixed in #22 (not released since 2018).

cb-khushbubibay commented 2 years ago

This issue has been addressed in v3.4.0. Hence closing it.