Numeric types cannot perform cast or arithmetic operations on PHP 7.3+
Description
Due to PHP 7.3 internal changes, cast_object now requires to handle a new case _IS_NUMBER, otherwise performing cast or arithmetic on numeric type objects will see the following error:
Object of class Cassandra\Bigint could not be converted to number
The specific PHP internal change is the following:
cast_object() with _IS_NUMBER The cast_object() object handler now also accepts the _IS_NUMBER type. The handler should return either an integer or float value in this case, whichever is more appropriate.
To make sure the numeric types can do type cast or arithmetic, it's required to update the cast_object implementation for those implements Numeric interface:
Due to PHP 7.3 internal changes, cast_object now requires to handle a new case _IS_NUMBER, otherwise performing cast or arithmetic on numeric type objects will see the following error:
The specific PHP internal change is the following:
From: https://raw.githubusercontent.com/php/php-src/PHP-7.3/UPGRADING.INTERNALS
To make sure the numeric types can do type cast or arithmetic, it's required to update the cast_object implementation for those implements Numeric interface:
Cassandra\Smallint
Cassandra\Bigint
Cassandra\Tinyint
Cassandra\Varint
Cassandra\Float
Cassandra\Decimal
We can also reference the commit from PHP source https://github.com/php/php-src/commit/b2b2b43 on the internal change and how to potential fix the issue.