Improve behavior of IP::toUnsigned on Windows
authorMormegil <mormegil@centrum.cz>
Tue, 25 Jun 2013 18:04:46 +0000 (20:04 +0200)
committerMormegil <mormegil@centrum.cz>
Tue, 25 Jun 2013 18:04:46 +0000 (20:04 +0200)
commit1437c25164e9352b945404df1e5fd809c95404d7
tree0cf8c84f232689230774525cc4fb077ae0a3e22f
parent505dbb331e16a03d87cb4511ee86df12ea295c40
Improve behavior of IP::toUnsigned on Windows

On Windows (and 32-bit systems), pow( 2, 32 ) - 1 is a float, which makes
IP::toUnsigned return a float sometimes (instead of string, int, or false,
as is specified in the documentation).

This makes problems for some callers (e.g. I0c9a4ae7 had to modify
wfBaseConvert because of this, while I believe this change would have made
that change unnecessary).

So to improve that, and make the result correspond to the documentation,
we ensure floats are converted to strings.

Plus, more phpunit coverage of IP::toUnsigned and the related IP::toHex.

Change-Id: Ic8e4d9c65497e78960b03555eab0558a6af7d8d2
includes/IP.php
tests/phpunit/includes/IPTest.php