PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Web Services » SOAP » Bug #6042

Handling xsd:long

Details

Submitted2005-11-23 10:18 UTC
Fromsimunek at vol dot cz
Assignedyunosh
StatusClosed
PackageSOAP
PHP Version4.4.1
OSFreeBSD
Roadmaps(Not assigned)

Comments

[2005-11-23 10:18 UTC] simunek at vol dot cz

Description:
------------
Per specifications, datatype xsd:long is a 64-bit integer. It's casted into integer PHP type in this PEAR class. PHP integer type is only 32-bit. That results in trimming the value down to MAXINT.

Bad news is that PHP don't have 64-bit integer (long long) type. Possible solutions would be to cast the value into string. That works for me.

Index: Base.php
===================================================================
RCS file: /repository/pear/SOAP/Base.php,v
retrieving revision 1.51
diff -a -u -r1.51 Base.php
--- Base.php 8 Oct 2005 23:44:22 -0000 1.51
+++ Base.php 23 Nov 2005 09:58:33 -0000
@@ -301,7 +301,7 @@
'integer' => 'integer',
'nonPositiveInteger' => 'integer',
'negativeInteger' => 'integer',
- 'long' => 'integer',
+ 'long' => 'string',
'int' => 'integer',
'short' => 'integer',
'byte' => 'string',

Test script:
---------------
<item><invoice_number xsi:type="xsd:long">6105003037</invoice_number></item>

Expected result:
----------------
6105003037

Actual result:
--------------
2147483647