Bug - Model.php throwing exception for underscored keys
jessedye opened this issue · comments
Error I am getting when testing my Webhook URL:
<br />
<b>Fatal error</b>: Uncaught Exception: Unknown property currency_code in ChargeBee_Subscription in /www/pf/chargebee/lib/ChargeBee/Model.php:75
Stack trace:
#0 /www/cb-events.php(27): ChargeBee_Model->__get('currency_code')
#1 {main}
thrown in <b>/www/pf/chargebee/lib/ChargeBee/Model.php</b> on line <b>75</b><br />
I'm currently getting a error exception thrown back when using webhooks. When using the ChargeBee_Event::deserialize($json)
value with an underscore is failing to be found. I tracked this down to line 75 of the following below. I ended up commenting out throw new Exception("Unknown property $k in " . get_class($this));
for now to solve my issue.
public function __get($k)
{
if (isset($this->_data[$k]))
{
return $this->_data[$k];
}
else if(in_array($k, $this->allowed))
{
return null;
}
else if(substr($k, 0, 2) == "cf") //All the custom fields start with prefix cf.
{
return null;
}
else
{
throw new Exception("Unknown property $k in " . get_class($this));
}
}
This has been fixed in v3.0.0