-
Notifications
You must be signed in to change notification settings - Fork 54
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
version compatibility between js and PHP implementation? #3
Comments
I can reproduce this. Same error for me. |
I get the same issue too. Any ideas what can be done to fix it yet? |
Looks like it's related to base64 encoding, 3rd party Base64 decode + LZString.decompress work correctly (so far at least, the original issue doesn't have 100% reproducibility). |
If you're passing the base64 data directly via URL, the PHP decoding process replaces the pluses with spaces which are not valid base64 characters. You may need to retrieve the parameter from the query string, then replace any spaces with pluses before base64 decode or decodeFromBase64. Escaping before passing the data may also resolve it. |
Hi, i've completely rewritten the PHP component to match the current algorythm / ouput provided by the javascript component. The bug is fixed in version 1.1.0. |
That's awesome - many thanks!! 👍 Definitely going to check this out. |
js: LZString.compressToBase64(document.getElementById('src').value);
php: $s=LZString::decompressFromBase64($_POST['s']);
value is caught by PHP script as intented with correct value. error happens in decompression:
Notice: Uninitialized string offset: 1123 in D:\babs\8.5\root\wwide\LZString.php on line 354
Warning: strpos() [function.strpos]: Empty delimiter in D:\babs\8.5\root\wwide\LZString.php on line 354
Fatal error: Uncaught exception 'Exception' with message '$c != $dictSize (133,128)' in D:\babs\8.5\root\wwide\LZString.php:313 Stack trace: #0 D:\babs\8.5\root\wwide\LZString.php(380): LZString::decompress('???????????????...') #1 D:\babs\8.5\root\wwide\wwc.php(6): LZString::decompressFromBase64('MQSwdgxgNgrgJgU...') #2 {main}
thrown in D:\babs\8.5\root\wwide\LZString.php on line 313
The text was updated successfully, but these errors were encountered: