Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encode(0xffffffff) returns empty string #33

Closed
ifduyue opened this issue Feb 10, 2015 · 3 comments
Closed

encode(0xffffffff) returns empty string #33

ifduyue opened this issue Feb 10, 2015 · 3 comments

Comments

@ifduyue
Copy link

ifduyue commented Feb 10, 2015

To reproduce:

<?php

require_once 'vendor/autoload.php';
$hashids = new Hashids\Hashids();
$id = $hashids->encode(0xffffffff);
var_dump($id);

echo "Hashids.php version is ".Hashids\Hashids::VERSION."\n";

Output:

string(0) ""
Hashids.php version is 1.0.5

PHP version:

$ php -v
PHP 5.6.3 (cli) (built: Nov 16 2014 08:32:30) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
@jd327
Copy link
Collaborator

jd327 commented Feb 10, 2015

Do you have a 32-bit system? It might be too big of an int to handle, because this works on mine.
Try checking the upper Hashids limit with $hashids->get_max_int_value();

https://github.com/ivanakimov/hashids.php#big-numbers

@ifduyue
Copy link
Author

ifduyue commented Feb 10, 2015

It's a 64-bit system. Sorry I didn't read through the readme. I install php-bcmath and the problem no longer exists.

Thanks for your time.

@ifduyue ifduyue closed this as completed Feb 10, 2015
@jd327
Copy link
Collaborator

jd327 commented Feb 10, 2015

Cool. Glad you got it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants