Zend Framework

Issue with Zend_XmlRpc_Value_Integer when casting a bigint

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.2
  • Fix Version/s: 1.9.2
  • Component/s: Zend_XmlRpc_Client
  • Labels:
    None

Description

Hi,

There is an issue with Zend_XmlRpc_Value_Integer there :

public function __construct($value)
    {
        $this->_type = self::XMLRPC_TYPE_INTEGER;
        $this->_value = (int)$value;    // Make sure this value is integer
    }

If we receive a value bigger than 2 147 483 647 then the value is truncated.

Activity

Hide
Wil Sinclair added a comment -

Please evaluate and fix/categorize as necessary.

Show
Wil Sinclair added a comment - Please evaluate and fix/categorize as necessary.
Hide
Darien Hager added a comment -

Isn't the XML-RPC spec that i4/int is a four-byte signed integer? The only way you're receiving or sending an integer > +2,147,483,647 is if the either you or the other end is breaking spec.

Show
Darien Hager added a comment - Isn't the XML-RPC spec that i4/int is a four-byte signed integer? The only way you're receiving or sending an integer > +2,147,483,647 is if the either you or the other end is breaking spec.
Hide
Satoru Yoshida added a comment -

Hello, all.

I think 2 solutions.
Do you think which is better?

1)
The Zend_XmlRpc_Value_Integer throws exception if the $value is bigger than 2 147 483 647 .

2)
We will recommend to validate parameter before using Zend_XmlRpc_Value_Integer in reference manual.

Show
Satoru Yoshida added a comment - Hello, all. I think 2 solutions. Do you think which is better? 1) The Zend_XmlRpc_Value_Integer throws exception if the $value is bigger than 2 147 483 647 . 2) We will recommend to validate parameter before using Zend_XmlRpc_Value_Integer in reference manual.
Hide
Michiel Brandenburg added a comment -

I would suggest that an exception is thrown (option 1) as an big integer (within xmlrpc) is an i8 type not int or i4

<int>2147483648</int> invalid (throw error)
<i8>2147483648</i8> no problem its a big int the other side is telling me.

Show
Michiel Brandenburg added a comment - I would suggest that an exception is thrown (option 1) as an big integer (within xmlrpc) is an i8 type not int or i4 <int>2147483648</int> invalid (throw error) <i8>2147483648</i8> no problem its a big int the other side is telling me.
Hide
Lars Strojny added a comment -

I've fixed this issue by just throwing an exception when an overlong integer is passed. I think supporting the non-standardized i8 element will be a good idea though, as it is implemented pretty widely. Resolved in r17753

Show
Lars Strojny added a comment - I've fixed this issue by just throwing an exception when an overlong integer is passed. I think supporting the non-standardized i8 element will be a good idea though, as it is implemented pretty widely. Resolved in r17753
Hide
Satoru Yoshida added a comment -

Thanks, Lars.
I set the Fix Version.

Show
Satoru Yoshida added a comment - Thanks, Lars. I set the Fix Version.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: