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

Error: tags_str2array(): Return value must be of type array, bool returned #1944

Closed
jwhaleyca opened this issue Feb 26, 2023 · 6 comments · Fixed by #1953
Closed

Error: tags_str2array(): Return value must be of type array, bool returned #1944

jwhaleyca opened this issue Feb 26, 2023 · 6 comments · Fixed by #1953
Labels
feedback needed support installation and configuration issues

Comments

@jwhaleyca
Copy link

Error opening Shaarli desktop after importing my bookmarks.

Error: tags_str2array(): Return value must be of type array, bool returned

    tags_str2array(): Return value must be of type array, bool returned

/var/www/shaarli/application/bookmark/LinkUtils.php222
#0 /var/www/shaarli/application/front/controller/visitor/BookmarkListController.php(82): tags_str2array()
#1 [internal function]: Shaarli\Front\Controller\Visitor\BookmarkListController->index()
#2 /var/www/shaarli/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func()
#3 /var/www/shaarli/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke()
#4 /var/www/shaarli/application/front/ShaarliMiddleware.php(55): Slim\Route->__invoke()
#5 [internal function]: Shaarli\Front\ShaarliMiddleware->__invoke()
#6 /var/www/shaarli/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()
#7 [internal function]: Slim\DeferredCallable->__invoke()
#8 /var/www/shaarli/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()
#9 /var/www/shaarli/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->Slim{closure}()
#10 /var/www/shaarli/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack()
#11 /var/www/shaarli/vendor/slim/slim/Slim/App.php(503): Slim\Route->run()
#12 /var/www/shaarli/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->__invoke()
#13 /var/www/shaarli/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack()
#14 /var/www/shaarli/vendor/slim/slim/Slim/App.php(297): Slim\App->process()
#15 /var/www/shaarli/index.php(202): Slim\App->run()
#16 {main}

@nodiscc
Copy link
Member

nodiscc commented Feb 27, 2023

Hi, please post

  • your shaarli version
  • the installation method used (from release zip, from source+composer, docker)
  • your PHP version
  • all steps leading to the error

@nodiscc nodiscc added support installation and configuration issues feedback needed labels Feb 27, 2023
@jwhaleyca
Copy link
Author

Shaarli dev / v0.12.1
Synology Task Manager to Docker Container
PHP v. 8.0.28
Steps: As soon as I login to Shaarli, the home page (My Links) shows the above error message. Note: all of my 4,500 links are there, I can see them under the "Daily" tab. I can open the "Tags" page but it immediately freezes up, so I can't search for a link using tags. And, of course, since my home page is just an error message, I can't filter searches by key word or tag there either.
Screen Shot 2023-02-27 at 9 58 42 PM

@nodiscc
Copy link
Member

nodiscc commented Mar 1, 2023

Shaarli dev / v0.12.1

Do you mean dev (master)? or v0.12.1? (which docker tag did you pull?) Or do you mean the problem is present with both?

Synology Task Manager to Docker Container

Please post the full installation steps (if this is through the Synology GUI, screenshots would be helpful). I am not familiar with this method and I don't think it was ever tested before. I don't think it matters since the app running inside a container should be completely independent from the environment outside it. But maybe it'll give us a clue.

after importing my bookmarks

Was the import successful? Did you get any error message while importing?

Are there any errors in the server/container logs?

@nodiscc nodiscc added this to the backlog to the future milestone Mar 1, 2023
@ArthurHoaro
Copy link
Member

I assume there is something wrong in the imported data, but it's true that in the line mentioned in the stack trace preg_split can return false if there is an issue with the regex. This case is not handled. I'll submit an easy fix to default to an empty array of tags.

@ArthurHoaro
Copy link
Member

ArthurHoaro commented Mar 18, 2023

Did you use a / as a tag separator, by any chance?

EDIT: I could reproduce the issue with this separator.

ArthurHoaro added a commit that referenced this issue Mar 18, 2023
Also in case of any other regex error, just return an empty array instead of a fatal error.

Fixes #1944
ArthurHoaro added a commit to ArthurHoaro/Shaarli that referenced this issue Mar 18, 2023
Also in case of any other regex error, just return an empty array instead of a fatal error.

Fixes shaarli#1944
@jwhaleyca
Copy link
Author

jwhaleyca commented Mar 18, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback needed support installation and configuration issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants