-
-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
Hi.
Using the example numbers:
$optimus = new Jenssegers\Optimus\Optimus(1580030173, 59260789, 1163945558);
$id = "1000000000"; //10 digits
$encoded = $optimus->encode($id);
$original = $optimus->decode($encoded);
print_r(array($id, $encoded, $original), true);
// ["1000000000", 1768948822, 1000000000]
$id = "10000000000"; //11 digits
$encoded = $optimus->encode($id);
$original = $optimus->decode($encoded);
print_r(array($id, $encoded, $original), true);
// ["10000000000", 2109978198, 856559616]
$id = "100000000000"; //12 digits
$encoded = $optimus->encode($id);
$original = $optimus->decode($encoded);
print_r(array($id, $encoded, $original), true);
// ["100000000000", 1163945558, 0]
My IDs are MySQL's bigint that can be 20 digits long! Optimus is not for me?
What am I missing? There is a length limit?
php -v
PHP 5.3.2-1ubuntu4.30 with Suhosin-Patch (cli) (built: Apr 17 2015 15:01:29)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
uname -a
Linux picard 2.6.32-74-server #142-Ubuntu SMP Tue Apr 28 10:12:19 UTC 2015 x86_64 GNU/Linux
I had to change line 108 at src/Optimus.php to get it working:
if (! in_array($mode, [static::MODE_GMP, static::MODE_NATIVE])) {
to
if (! in_array($mode, array(static::MODE_GMP, static::MODE_NATIVE)) ) {
Thanks in advance.
Metadata
Metadata
Assignees
Labels
No labels