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

Update using of JWT methods encode and decode #99

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

yurabakhtin
Copy link

Issue:

FEHLER Wed, 10 May 2023 18:32:19 +0200 ArgumentCountError
ArgumentCountError: Too few arguments to function Firebase\JWT\JWT::encode(), 2 passed in /srv/www/htdocs/doku2/modules/onlyoffice/Module.php on line 399 and at least 3 expected in /srv/humhub/protected/vendor/firebase/php-jwt/src/JWT.php:184
Stack trace:
#0 /srv/www/htdocs/doku2/modules/onlyoffice/Module.php(399): Firebase\JWT\JWT::encode()
#1 /srv/www/htdocs/doku2/modules/onlyoffice/controllers/AdminController.php(150): humhub\modules\onlyoffice\Module->generateHash()
#2 /srv/www/htdocs/doku2/modules/onlyoffice/controllers/AdminController.php(104): humhub\modules\onlyoffice\controllers\AdminController->checkConvertFile()
#3 /srv/www/htdocs/doku2/modules/onlyoffice/controllers/AdminController.php(75): humhub\modules\onlyoffice\controllers\AdminController->validation()
#4 [internal function]: humhub\modules\onlyoffice\controllers\AdminController->actionSave()
#5 /srv/humhub/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#6 /srv/humhub/protected/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#7 /srv/humhub/protected/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#8 /srv/humhub/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction()
#9 /srv/humhub/protected/vendor/yiisoft/yii2/base/Application.php(384): yii\web\Application->handleRequest()
#10 /srv/www/htdocs/doku2/index.php(24): yii\base\Application->run()
#11 {main}

Old version:

alg

after run composer install I see the method was updated:

alf_after_update

@luke-
Copy link

luke- commented Jun 20, 2023

With HumHub v1.15 we're updating the JWT Library with requires this change.
This change is also compatible with earlier HumHub versions.

@LinneyS LinneyS requested a review from rivexe June 22, 2023 05:07
@LinneyS LinneyS changed the base branch from master to develop August 3, 2023 10:11
@LinneyS LinneyS requested review from Antipkin-A and removed request for rivexe August 3, 2023 10:11
@LinneyS LinneyS merged commit 8cdedcf into ONLYOFFICE:develop Aug 4, 2023
2 of 3 checks passed
@LinneyS
Copy link
Member

LinneyS commented Aug 4, 2023

@yurabakhtin
thanks for the help

@luke- luke- mentioned this pull request Oct 12, 2023
@@ -405,7 +421,7 @@ public function generateHash($key, $userGuid, $isEmpty = false)
public function readHash($hash)
{
try {
$data = JWT::decode($hash, Yii::$app->settings->get('secret'), array('HS256'));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this should have been removed, at most getJwtAlgorithm() should also be used here.

@WizWareTech
Copy link

I'm having trouble following along. Is this issue resolved? If so, how to I implement the fix on my system?

@WizWareTech
Copy link

I made a little progress. I downloaded the current onlyoffice-humhub-develop and replaced my plugin manually with that. Now I can edit files! (and I'm running the most recent 1.15). But, when I try to create new files, I get this error:

An unexpected server error occurred. If this keeps happening, please contact a site administrator.
{
"url": "/onlyoffice/create/document?extension=xlsx",
"status": 500,
"response": {
"error": true,
"message": "An internal server error occurred."
},
"textStatus": "error",
"xhr": {
"readyState": 4,
"responseText": "{"error":true,"message":"An internal server error occurred."}",
"responseJSON": {
"error": true,
"message": "An internal server error occurred."
},
"status": 500,
"statusText": "Internal Server Error"
},
"dataType": "json",
"error": true,
"message": "An internal server error occurred.",
"errorThrown": "Internal Server Error",
"validationError": false
}

Log entry:

ERROR Fri, 10 Nov 2023 14:49:33 -0700 yii\base\ErrorException:2
yii\base\ErrorException: filesize(): stat failed for /var/www/humhub/protected/modules/onlyoffice/resources/templates/en-US/new.xlsx in /var/www/humhub/protected/modules/onlyoffice/models/CreateDocument.php:73
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError()
#1 /var/www/humhub/protected/modules/onlyoffice/models/CreateDocument.php(73): filesize()
#2 /var/www/humhub/protected/modules/onlyoffice/controllers/CreateController.php(49): humhub\modules\onlyoffice\models\CreateDocument->save()
#3 [internal function]: humhub\modules\onlyoffice\controllers\CreateController->actionDocument()
#4 /var/www/humhub/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#5 /var/www/humhub/protected/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#6 /var/www/humhub/protected/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
#7 /var/www/humhub/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction()
#8 /var/www/humhub/protected/vendor/yiisoft/yii2/base/Application.php(384): yii\web\Application->handleRequest()
#9 /var/www/humhub/index.php(25): yii\base\Application->run()
#10 {main}

@WizWareTech
Copy link

ok I think I got it. I found that the download didn't include the document template folder referenced above so I went and got https://github.com/ONLYOFFICE/document-templates/tree/f00ab3a3efe6e2f8542ba026d1fc1d72df7dfd5f then put it in place and now all seems to be working again.

I'm sure this wasn't the right way to do all this, so can someone please point me to the correct procedure so I didn't create another problem for myself?

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

Successfully merging this pull request may close these issues.

Bug with Firebase ONLYOFFICE cannot view or edit files after upgrading from 1.13 to 1.15 beta 1
6 participants