Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 10.

To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects

Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.

The patches will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated patches until this issue is closed

    If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated patches.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated patches will be posted here.

    If the issue is reopened, then new automated patches will be posted.

    If you are using another issue(s) to work on Drupal 10 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

Providing feedback

If there are problems with one of the patches posted by the Project Update Bot, such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue.

Issue fork fivestar-3287600

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Tag1 fosters the development of DrupalTag1 logo

Comments

Project Update Bot created an issue. See original summary.

Project Update Bot’s picture

Status: Active » Needs review
FileSize
2.44 KB

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.

Currently Drupal Rector, version 0.12.0, cannot fix all Drupal 10 compatibility problems.

This patch does not update the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #127

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.9
  2. palantirnet/drupal-rector: 0.12.0
dancbatista’s picture

Assigned: Unassigned » dancbatista
Issue summary: View changes
Status: Needs review » Needs work

I will work on it!

Kristen Pol’s picture

@dancbatista If you are unable to work on this, please un-assign.

dancbatista’s picture

I'm working on this @Kristen Pol!

Kristen Pol’s picture

@dancbatista Thanks for the update!

dancbatista’s picture

Assigned: dancbatista » Unassigned
Status: Needs work » Needs review
FileSize
5.93 KB
3.2 KB

I found another patch that can fix the problem with the Fivestar preview theme function. It's here: https://www.drupal.org/project/fivestar/issues/3273701. All other problems with compatibility with Drupal 10 were fixed.

TR’s picture

Status: Needs review » Needs work

Thank you for working on this. This whole automated patch thing is a bit of a mess because it is incomplete and does things that are really not Drupal 10 related.

What I would like to do here is have more than one issue so these changes aren't all mixed up. You've added a bunch of extra changes without discussion and without explaining what you were doing or why - those things should be done in separate issues. For example:

-    - core/jquery.once
+    - core/once

This also requires changes to fivestar.js, which you haven't done in this patch. Similarly,

-    if (empty($vote_ids)) {
+    if (!empty($vote_ids)) {

If there is a bug in this statement, there should be an issue explaining the problem where we can discuss it and present a patch. You are making this line do the opposite of what it used to do, which is way out of scope for D10 compatibility. There are also other changes you've made without explanation - those should all have their own issues if you think there is a bug or if you want to add a new feature. This current issue is not the place to do either.

The only D10 compatibility problems with this module are the theme functions, which already have an issue, and the one line in the tests that uses assertRaw() which is no longer available in D10. Nothing else. The return type declarations are nice to have now that the minimum PHP of Drupal core supports this, but ALL the test functions should have them, and all of those should be changed together in one patch IMO. Likewise, we should begin to add return type declarations to Fivestar API functions, not just the tests, but the tests are a place where this can be done without breaking backwards compatibility so we should do it in the tests first.

The theme function meta issue is really the blocking issue for D10, and until that is fixed I don't want to change the .info.yml or composer.json to say that the module is D10 compatible, because it isn't until that is fixed.

So what I suggest is to re-roll the patch for just the assertRaw() change so we can fix that here. Then open new issues for 1) the return type declarations in the tests, 2) The jquery.once changes, 3) your new display settings feature, 4) any bugs you have found like empty($vote_ids), 5) etc.

dancbatista’s picture

Assigned: Unassigned » dancbatista

Thanks for the feedback @TR I will work on this!

heddn’s picture

Yes, the once changes are definitely needed. https://www.drupal.org/node/3158256 has some guidance on how to rectify.

dancbatista’s picture

Assigned: dancbatista » Unassigned
Status: Needs work » Needs review
FileSize
682 bytes

Hi, @TR I followed your suggestion and re-rolled the patch for just assert raw() change. I will create the other issues separately.

DeepaliJ’s picture

Assigned: Unassigned » DeepaliJ
DeepaliJ’s picture

FileSize
459.81 KB
138.01 KB

Verified the module by applying patch #11.
Scanned using Upgrade Status.
The module is incompatible with Drupal 10, although it is not showing any error but showing warnings which seems fixable as shown in the attached screenshots
Upgrade status
upgrade status

Warnings
Warnings

Also, this module cannot be made D10 compatible unless and until votingapi module is not made compatible with D10

DeepaliJ’s picture

Assigned: DeepaliJ » Unassigned
Status: Needs review » Needs work
dancbatista’s picture

Status: Needs work » Needs review

@Deepalij following the instruction of @TR in #8 I just to applied assertRaw() change (In the line 145 of FivestarTest.php I'm using the function $this->assertSession()->responseContains() instead). So For the other changes, I will create issues separately. Please just scan the module with Upgrade Status before using the patch and scan again after using it and observe if the warning about assertRaw() is fixed.

vitorbs’s picture

Assigned: Unassigned » vitorbs

I'll review this one.

vitorbs’s picture

-

vitorbs’s picture

Status: Needs review » Needs work

As @dancbatista said, the patch is re-rolled and only change the test function, so the others problems is better to create another issues to work on them. Moving to RTBC, if anyone disagree with me please tell me and i will work on it. Thanks!

vitorbs’s picture

Status: Needs work » Reviewed & tested by the community
Webbeh’s picture

Please do not roll a ProjectBot project to RTBC:

If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review or Needs work) and no more automated patches will be posted here.

Removing screenshots.

Webbeh’s picture

Status: Reviewed & tested by the community » Active
Webbeh’s picture

Assigned: vitorbs » Unassigned
Webbeh’s picture

Status: Active » Needs review

Ah, resetting to Needs Review for review by maintainer TR in #8 and work completed in #11.

dancbatista’s picture

Being mentored for @TR in #8, I've created the following related issues.:
1) The return type declarations in the tests #3308839: Return type declarations in the tests
2) The jquery.once changes for the module #3309729: The jquery.once changes for the module

Project Update Bot’s picture

Issue summary: View changes
mmjvb’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

With https://www.drupal.org/project/infrastructure/issues/3309815) fixed, setting RTBC is no longer considered sabotaging the bot.

Attracting attention of maintainer to commit. Suggest to set to Active when committed to receive potential additional fixes from the bot.

heddn’s picture

This is a combined patch of #3308839: Return type declarations in the tests and #3309729: The jquery.once changes for the module with the needed drupal 10 .info.yml changes added to show tests pass on the testbot.

edurenye’s picture

Status: Reviewed & tested by the community » Needs review

votingapi supports D10 in the -dev version of the module.

Setting to needs review because there is a new patch and also to get updates from the Project Update Bot.

wxman’s picture

Does anyone know if there will be a update coming? I added this to a site I'm designing because it does exactly what I need. I'm not a lot of help in fixing problems, though I wish I was.

wxman’s picture

If it helps anyone, I applied the patch in #27 then ran upgrade status.

web/modules/contrib/fivestar/fivestar.module
Line 82: The module is defining "theme_fivestar_preview" theme function. Theme functions are deprecated. For more info, see https://www.drupal.org/node/2575445.

web/modules/contrib/fivestar/composer.json
Line 0: The drupal/core requirement is not compatible with the next major version of Drupal. Either remove it or update it to be compatible. See https://drupal.org/node/2514612#s-drupal-9-compatibility.

This seemed to work until I went to a page showing the votes. For every book cover with votes under it I had:
Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1525 of core/lib/Drupal/Core/Database/Connection.php).

I couldn't track down what was the cause so I had to go back to my saved backup of fivestar before the patch.

TR’s picture

A lot of this has now been done in other patches. To see what problems remain, I'm going to try testing against D10 here.

chike’s picture

Patch #31 in combination with MR !10 at The jquery.once changes for the module and patch #3 at Remove 'fivestar_preview' theme function got the module working.

AbhinavK’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
4.3 KB

As mentioned in #33, the combination of Patch #31 with MR !10 of The jquery.once changes for the module and Patch #3 of Remove 'fivestar_preview' theme function makes the module Drupal 10 compatible.

So changing the status to RTBC.

Also uploading a combined patch of all the changes for anyone who needs it.

TR’s picture

Status: Reviewed & tested by the community » Active

Please comment in those other issues - that is where those problems are being discussed.

Diego_Mow’s picture

Both issues are RTBC.
I'd suggest we get them merged ASAP as they are blockers for future of this module.

RgnYLDZ’s picture

Any update on RTBC?

Libbna’s picture

After updating the site to d10, I am trying to apply the #34 patch using drupal-lenient but after running composer install it throws error "Cannot apply patch". Can anyone tell me the reason for this issue? Thannks.

It got resolved, I had to remove two extra patches that was added for fivestar.

wxman’s picture

I read the comment above, but the only FiveStar patch I have is the d10_combined_3287600-34.patch. Mine won't load either, and FiveStar has stopped working. I'm also back to getting Deprecated function: addcslashes() errors.

O'Briat made their first commit to this issue’s fork.

O'Briat’s picture

I made a MR with the latest combined patch from #34, so you could install it with drupal 10 composer.

You have to use a specific version in require section (here's 1.x-dev), then add a new repository (with the same version) before the drupal one (see https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-pa...).
:

    "require": {
...
        "drupal/fivestar": "1.x-dev",
...
    "repositories": {
        "fivestar" : {
            "type": "package",
            "package": {
                "name": "drupal/fivestar",
                "type": "drupal-module",
                "version": "1.x-dev",
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3287600/",
                    "reference": "99e6a9bb1f6407a143d664bcb61e29d10b3de4af"
                }
            }
        },
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
...
wxman’s picture

I gave #42 a try.

  Problem 1
    - Root composer.json requires drupal/fivestar ^1.0@alpha, it is satisfiable by drupal/fivestar[1.0.0-alpha1, 1.0.0-alpha2, 1.0.0-alpha3] from composer repo (https://packag                       es.drupal.org/8) but drupal/fivestar[1.x-dev] from package repo (defining 1 package) has higher repository priority. The packages from the higher priority repository do not ma                       tch your minimum-stability and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.o                       rg/repoprio for details and assistance.

Not sure what's going wrong. I'm running Version: 8.x-1.0-alpha3

O'Briat’s picture

You have to edit your repositories section in composer.json, put this custom repo before the https://packages.drupal.org/8 one.
(I will update my comment to be more clear)
See https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-pa...

wxman’s picture

That's kind of what I did. Here's my composer.json:

    "repositories": {
        "fivestar" : {
            "type": "package",
            "package": {
                "name": "drupal/fivestar",
                "type": "drupal-module",
                "version": "1.x-dev",
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3287600/",
                    "reference": "99e6a9bb1f6407a143d664bcb61e29d10b3de4af"
                }
            }
        },
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "0": {
            "type": "vcs",
            "url": "https://github.com/mcaskill/composer-merge-plugin"
        },
        "1": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "2": {
            "type": "composer",
            "url": "https://asset-packagist.org"
        },
        "3": {
            "type": "composer",
            "url": "https://packagist.org"
        }
    },

I don't remember why I have the second
"1": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},

My Require is : "drupal/fivestar": "^1.0@alpha",
could that be the problem?

wxman’s picture

I changed the version to match mine "version": "1.x-dev", changed to: "version": "1.0@alpha",
After running update I get no errors there, but I'm still getting "Deprecated function: addcslashes()" errors, and the stars are not working.

O'Briat’s picture

Where did you see these errors?
Can you check that the patch is apply to the installed module ?
As far as I know "addcslashes" is not used in the fivestar module, could you check to which file+line this error points?

As for your compose.json
"https://packages.drupal.org/8" is the main drupal repo, so its fine (but it's duplicated in the entry "1", so you could safely remove it).

I think the packagist ones are useless since it's the default composer repo (https://getcomposer.org/doc/04-

O'Briat’s picture

Note that core requirement should not be places inside a module composer.json requirements, see https://www.drupal.org/docs/develop/creating-modules/add-a-composerjson-...)
I add a commit to this MR that remove it.

wxman’s picture

To answer #48 I did not change anything like that.

To answer #47. If you see in my response #45, that is what my composer.json looked like. My other question was regarding whether I should change the 'require' on my composer.json which is "drupal/fivestar": "^1.0@alpha", to match your version in the repository: "version": "1.x-dev",?

I know it's long but here's the error

Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1525 of /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Database/Connection.php)

#0 /var/www/vhosts/website.com/testsite/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Database/Connection.php(1525): addcslashes()
#3 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Database/Query/Select.php(431): Drupal\Core\Database\Connection->escapeLike()
#4 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php(125): Drupal\Core\Database\Query\Select->escapeLike()
#5 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php(70): Drupal\Core\Entity\Query\Sql\Condition::translateCondition()
#6 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(177): Drupal\Core\Entity\Query\Sql\Condition->compile()
#7 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(81): Drupal\Core\Entity\Query\Sql\Query->compile()
#8 /var/www/vhosts/website.com/testsite/web/modules/contrib/fivestar/src/Element/Fivestar.php(273): Drupal\Core\Entity\Query\Sql\Query->execute()
#9 /var/www/vhosts/website.com/testsite/web/modules/contrib/fivestar/src/Element/Fivestar.php(85): Drupal\fivestar\Element\Fivestar::userCanVote()
#10 [internal function]: Drupal\fivestar\Element\Fivestar::process()
#11 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Form/FormBuilder.php(1012): call_user_func_array()
#12 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Form/FormBuilder.php(1075): Drupal\Core\Form\FormBuilder->doBuildForm()
#13 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Form/FormBuilder.php(579): Drupal\Core\Form\FormBuilder->doBuildForm()
#14 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm()
#15 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Form/FormBuilder.php(224): Drupal\Core\Form\FormBuilder->buildForm()
#16 /var/www/vhosts/website.com/testsite/web/modules/contrib/fivestar/src/Plugin/Field/FieldFormatter/StarsFormatter.php(127): Drupal\Core\Form\FormBuilder->getForm()
#17 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Field/FormatterBase.php(89): Drupal\fivestar\Plugin\Field\FieldFormatter\StarsFormatter->viewElements()
#18 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(265): Drupal\Core\Field\FormatterBase->view()
#19 /var/www/vhosts/website.com/testsite/web/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php(266): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple()
#20 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(340): Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple()
#21 /var/www/vhosts/website.com/testsite/web/core/modules/node/src/NodeViewBuilder.php(24): Drupal\Core\Entity\EntityViewBuilder->buildComponents()
#22 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(282): Drupal\node\NodeViewBuilder->buildComponents()
#23 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#24 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
#25 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#26 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#27 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
#28 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#29 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Template/TwigExtension.php(581): Drupal\Core\Render\Renderer->render()
#30 /var/www/vhosts/website.com/testsite/web/sites/default/files/php/twig/64bd70f4915fd_views-view-mlayout-5.html_ANXr5Onzt4biZh4u827kbUT5-/oU5uBauK5Ox6_MWEHR8fS9OZp_RzdDMED5l_znZnIUY.php(103): Drupal\Core\Template\TwigExtension->renderVar()
#31 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(405): __TwigTemplate_e2e546e79f8e3b21f07a2b6002aa3215->doDisplay()
#32 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#33 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#34 /var/www/vhosts/website.com/testsite/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#35 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#36 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#37 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#38 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#39 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#40 /var/www/vhosts/website.com/testsite/web/sites/default/files/php/twig/64bd70f4915fd_views-view.html.twig_KWfCQbL2kb8Qiz3628oxhPMt5/kgECs-PdVOEMvpqcJaf9yCmcTtyh-MGo6ZrqhhxHMxY.php(85): Drupal\Core\Template\TwigExtension->escapeFilter()
#41 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(405): __TwigTemplate_db75f6aa28fbdc4591c136018f016cf5->doDisplay()
#42 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#43 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#44 /var/www/vhosts/website.com/testsite/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#45 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#46 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#47 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#48 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#49 /var/www/vhosts/website.com/testsite/web/themes/contrib/gavias_remito/gva_elements/gsc_view.php(167): Drupal\Core\Render\Renderer->render()
#50 /var/www/vhosts/website.com/testsite/web/themes/contrib/gavias_remito/gva_elements/gsc_view.php(105): Drupal\gavias_blockbuilder\shortcodes\gsc_view->sc_drupal_block()
#51 /var/www/vhosts/website.com/testsite/web/modules/contrib/gva_blockbuilder/templates/frontend/print-builder.php(85): Drupal\gavias_blockbuilder\shortcodes\gsc_view->render_content()
#52 /var/www/vhosts/website.com/testsite/web/modules/contrib/gva_blockbuilder/includes/frontend.php(92): include('...')
#53 /var/www/vhosts/website.com/testsite/web/modules/contrib/gva_blockbuilder/includes/shortcode_block.php(20): gavias_blockbuilder_frontend()
#54 /var/www/vhosts/website.com/testsite/web/modules/contrib/gva_blockbuilder/includes/core/shortcode.php(308): sc_blockbulider()
#55 [internal function]: do_shortcode_tag()
#56 /var/www/vhosts/website.com/testsite/web/modules/contrib/gva_blockbuilder/includes/core/shortcode.php(210): preg_replace_callback()
#57 /var/www/vhosts/website.com/testsite/web/modules/contrib/gva_blockbuilder/src/Plugin/Filter/Shortcode.php(40): do_shortcode()
#58 /var/www/vhosts/website.com/testsite/web/core/modules/filter/src/Element/ProcessedText.php(118): Drupal\gavias_blockbuilder\Plugin\Filter\Shortcode->process()
#59 [internal function]: Drupal\filter\Element\ProcessedText::preRenderText()
#60 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#61 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#62 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
#63 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#64 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#65 /var/www/vhosts/website.com/testsite/web/sites/default/files/php/twig/64bd70f4915fd_field.html.twig_9C5uMQbxbPdRTfdZZ1PO7ozmz/lwf3T1OJWuF072xcqDcfz-V0E8qafwG5IleVYP7GS38.php(87): Drupal\Core\Template\TwigExtension->escapeFilter()
#66 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(405): __TwigTemplate_9301eadb69d5c3ea9e6886b2b9a6949b->doDisplay()
#67 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#68 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#69 /var/www/vhosts/website.com/testsite/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#70 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#71 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#72 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#73 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#74 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render()
#75 /var/www/vhosts/website.com/testsite/web/sites/default/files/php/twig/64bd70f4915fd_node.html.twig_JiTjjPoLZm2mq-Tx9g_ymGGgQ/r_0i6LXMvqd5sOU-5vejgkRuG1agjArKjpaxWC3Nk5Q.php(113): Drupal\Core\Template\TwigExtension->escapeFilter()
#76 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(405): __TwigTemplate_ba986af2b0eac7f504389a88fa295e94->doDisplay()
#77 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling()
#78 /var/www/vhosts/website.com/testsite/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#79 /var/www/vhosts/website.com/testsite/web/core/themes/engines/twig/twig.engine(55): Twig\Template->render()
#80 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#81 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#82 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#83 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#84 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#85 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(243): Drupal\Core\Render\Renderer->executeInRenderContext()
#86 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#87 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#88 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#89 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#90 /var/www/vhosts/website.com/testsite/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#91 /var/www/vhosts/website.com/testsite/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#92 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#93 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#94 /var/www/vhosts/website.com/testsite/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#95 /var/www/vhosts/website.com/testsite/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#96 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#97 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#98 /var/www/vhosts/website.com/testsite/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#99 /var/www/vhosts/website.com/testsite/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#100 /var/www/vhosts/website.com/testsite/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#101 {main}
O'Briat’s picture

#48 was a general notice and directed to module maintainer.

#47 the same version should be used in require > "drupal/fivestar": "1.x-dev" and repositories > fivestar > package > "version": "1.x-dev", (I'm not sure if the value matter, but it should be the same in the two spots)

About your error, it seems like a notice about deprecated usage that originated from an entity in src/Element/Fivestar.php(273). That part is not covered by this issue but is tracked in another one: https://www.drupal.org/project/fivestar/issues/3324052.
Could you test this patch?

Could you also describe the steps to reproduce this error, so I can test it myself?

heddn’s picture

@TR, any direction on porting this and votingapi to D10? I tried to put forward an effort about 6 months ago and it got bogged down on needing tests. Someone tried to write tests, but that got bogged down too. We're now 4-5 months from loosing D9 support and this pair of modules is the lone blocker to upgrading. What is a workable plan to get us to D10?

Unfortunately, the budget and window I had to push the dial on this 6 months has since dried up. So I'm more interested now as an observer rather then a super active participant. I'm happy to do reviews and confirm any work here still is functional on D10. But don't have a lot of extra time right now.

wxman’s picture

@O'Briat I probably have a bigger problem then. I just made a D9 test site, installed 8.x-1.x-dev, edited the composer.json as you suggested, and added a Fivestar field to a test content. It's working fine with no errors. There must be something else conflicting with it on the other site that's causing the error.

O'Briat’s picture

@wsman, if you are not using ad Drupal 10 coren you could just use the patching system (not need to declare a new repository),e.g.:

{
    "name": "test",
    "description": "test",
    "license": "GPL-2.0-or-later",
    "type": "project",
    "authors": [
        {
            "name": "",
            "email": "",
            "role": "Maintainer"
        }
    ],
    "require": {
        "composer/installers": "^2",
        "cweagans/composer-patches": "^1.6",
        "drupal/core-composer-scaffold": "^10.0",
        "drupal/core-recommended": "^10.0",
        "drupal/fivestar": "1.x-dev"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "repositories": {
          "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "allow-plugins": {
            "composer/installers": true,
            "cweagans/composer-patches": true,
            "drupal/core-composer-scaffold": true
        },
        "apcu-autoloader": true,
        "autoloader-suffix": "Drupal8",
        "discard-changes": true,
        "optimize-autoloader": true,
        "process-timeout": 0,
        "sort-packages": true
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/profiles/custom/{$name}": [
                "type:drupal-custom-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "web/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "patches": {
            "drupal/fivestar": {
                "Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2023-04-20/d10_combined_3287600-34.patch"
            }
        }
    },
    "scripts": {
        "post-install-cmd": [
            "@composer drupal:scaffold"
        ],
        "post-update-cmd": [
            "@composer drupal:scaffold"
        ]
    }
}

wxman’s picture

@O'Briat My main site will be D10 as soon as I can get this all fixed. Fivestar is the last one I need to get working. My temporary site I just made used the latest D9 version, and 8.x-1.x-dev for Fivestar. It's working great with no errors at all. That seems to mean something else on my main site is causing the error.

As a test on my main D9 site which is using 8.x-1.x-dev, and the edited JSON, I went to the book page it's on and removed the block with the Fivestar rating. The error went away, I added the field back in and the error returned.

I also just tried changing my theme on the main site to the Claro 9.5.10 theme. The error appeared again as soon as I added Fivestar to the page display.

wxman’s picture

@O'Briat I think I did it! I just couldn't figure out the reference hash, but I think I got it right.

    "repositories": {
        "fivestar" : {
            "type": "package",
            "package": {
                "name": "drupal/fivestar",
                "type": "drupal-module",
                "version": "1.x-dev",
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3287600/",
                    "reference": "99e6a9bb1f6407a143d664bcb61e29d10b3de4af"
                },
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3324052/",
                    "reference": "51b40c765a37cf34140996e325f2551462d9857e"
                }
            }
        },
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "0": {
            "type": "vcs",
            "url": "https://github.com/mcaskill/composer-merge-plugin"
        }
    },

Ran composer update, the drush cr, and all the errors are gone completely. Now after all of this I'm guessing none of it will work on a D10 site yet?

wxman’s picture

Even after all the MR and patches the D10 testing still shows the FivestarTest.php 'assertRaw()' error.
The other two are connected with web/modules/contrib/fivestar/fivestar.libraries.yml. The 'fivestar.base' library, and 'fivestar.ajax' library depending on the core/jquery.once asset library.

DamienMcKenna’s picture

Status: Active » Needs work

I think this is the appropriate status, given it seems a small change is needed for the Once library.

See https://www.drupal.org/node/3158256 for details.

heddn’s picture

wxman’s picture

I tried adding the MR in #15 in that topic but mine is still showing those errors for D10 upgrades

O'Briat’s picture

Status: Needs work » Active

Here's the drupal-check on the patched module:

./vendor/bin/drupal-check --php8 web/modules/contrib/fivestar
 21/21 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ---------------------------------------------
  Line   fivestar.install
 ------ ---------------------------------------------
  55     Variable $display_map might not be defined.
 ------ ---------------------------------------------

 ------ ---------------------------------------------------------------------
  Line   fivestar.module
 ------ ---------------------------------------------------------------------
  95     Function field_read_fields not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
  102    Function field_read_instances not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
 ------ ---------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------
  Line   src/Element/Fivestar.php
 ------ -----------------------------------------------------------------------------------------------------------------------
  215    Method Drupal\fivestar\Element\Fivestar::getElementDescription() should return array but return statement is missing.
  293    Call to an undefined method Drupal\Core\Entity\EntityInterface::getOwner().
 ------ -----------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------
  Line   src/Plugin/Field/FieldFormatter/PercentageFormatter.php
 ------ ---------------------------------------------------------
  51     Variable $item might not be defined.
 ------ ---------------------------------------------------------

 ------ -----------------------------------------------------
  Line   src/Plugin/Field/FieldFormatter/RatingFormatter.php
 ------ -----------------------------------------------------
  51     Variable $item might not be defined.
 ------ -----------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------
  Line   src/Plugin/Field/FieldFormatter/StarsFormatter.php
 ------ ------------------------------------------------------------------------------------------------
  126    Method Drupal\Core\Form\FormBuilderInterface::getForm() invoked with 2 parameters, 1 required.
  142    Method Drupal\Core\Form\FormBuilderInterface::getForm() invoked with 2 parameters, 1 required.
 ------ ------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------------
  Line   src/Plugin/Field/FieldType/FivestarItem.php
 ------ --------------------------------------------------------------------------------------------------------------------------
  242    Access to an undefined property Drupal\Core\Field\FieldItemListInterface<Drupal\Core\Field\FieldItemInterface>::$rating.
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
  274    Call to an undefined method Drupal\Core\Entity\FieldableEntityInterface::isPublished().
  335    Call to an undefined method Drupal\Core\Entity\EntityInterface::getOwnerId().
  336    Call to an undefined method Drupal\Core\Entity\EntityInterface::getValue().
  337    Call to an undefined method Drupal\Core\Entity\EntityInterface::getSource().
 ------ --------------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------
  Line   src/Plugin/Field/FieldWidget/SelectWidget.php
 ------ ---------------------------------------------------------------------------------------------
  25     Call to an undefined method Drupal\Core\TypedData\TypedDataInterface::getFieldDefinition().
  46     Call to an undefined method Drupal\Core\TypedData\TypedDataInterface::getFieldDefinition().
 ------ ---------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------
  Line   src/Plugin/Field/FieldWidget/StarsWidget.php
 ------ ---------------------------------------------------------------------------------------------
  113    Call to an undefined method Drupal\Core\TypedData\TypedDataInterface::getFieldDefinition().
 ------ ---------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------
  Line   src/VoteManager.php
 ------ ---------------------------------------------------------------------------------------
  82     Call to an undefined method Drupal\Core\Entity\EntityInterface::setVotedEntityId().
  83     Call to an undefined method Drupal\Core\Entity\EntityInterface::setVotedEntityType().
  84     Call to an undefined method Drupal\Core\Entity\EntityInterface::setOwnerId().
  85     Call to an undefined method Drupal\Core\Entity\EntityInterface::setValue().
 ------ ---------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------
  Line   tests/src/Functional/FivestarTest.php
 ------ --------------------------------------------------------------------------------------------
  61     Variable $displayRepository in PHPDoc tag @var does not exist.
  108    Call to an undefined method Drupal\Tests\fivestar\Functional\FivestarTest::assertEquals().
  108    Call to method getText() on an unknown class Behat\Mink\Element\NodeElement.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
  151    Call to an undefined method Drupal\Tests\fivestar\Functional\FivestarTest::assertEmpty().
  158    Call to an undefined method Drupal\Tests\WebAssert::pageTextContains().
 ------ --------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------
  Line   tests/src/FunctionalJavascript/FivestarAjaxTestBase.php
 ------ ----------------------------------------------------------------
  60     Variable $displayRepository in PHPDoc tag @var does not exist.
 ------ ----------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------
  Line   tests/src/Kernel/HookFivestarWidgetsAlterTest.php
 ------ -------------------------------------------------------------------------------------------------------------
  47     Call to an undefined method Drupal\Tests\fivestar\Kernel\HookFivestarWidgetsAlterTest::assertArrayHasKey().
  48     Call to an undefined method Drupal\Tests\fivestar\Kernel\HookFivestarWidgetsAlterTest::assertEquals().
 ------ -------------------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------
  Line   tests/src/Kernel/HookFivestarWidgetsTest.php
 ------ --------------------------------------------------------------------------------------------------------
  60     Call to an undefined method Drupal\Tests\fivestar\Kernel\HookFivestarWidgetsTest::assertArrayHasKey().
  61     Call to an undefined method Drupal\Tests\fivestar\Kernel\HookFivestarWidgetsTest::assertEquals().
  62     Call to an undefined method Drupal\Tests\fivestar\Kernel\HookFivestarWidgetsTest::assertEquals().
  65     Call to an undefined method Drupal\Tests\fivestar\Kernel\HookFivestarWidgetsTest::assertArrayHasKey().
  66     Call to an undefined method Drupal\Tests\fivestar\Kernel\HookFivestarWidgetsTest::assertEquals().
  67     Call to an undefined method Drupal\Tests\fivestar\Kernel\HookFivestarWidgetsTest::assertEquals().
 ------ --------------------------------------------------------------------------------------------------------

 [ERROR] Found 35 errors
O&#039;Briat’s picture

Status: Active » Needs work

@wxman, I pretty sure that you could not set more than one source in a repository. I think you should use the repo to get this issue and use the patch section to apply additional patches. Maybe we could continue this discussion on slack to avoid polluting this thread ?

@DamienMcKenna @heddn, as said in #42 the MR (https://git.drupalcode.org/project/fivestar/-/merge_requests/19/diffs) contains the whole combined patch from #34 which contain the "once" correction provided by #3309729 (which is RTBTC), so this problem should not occur.

heddn’s picture

Status: Needs work » Reviewed & tested by the community

I took the patch from #34 and applied it to a D10 site w/ the lenient composer plugin. I'm able to vote using fivestar widget. I think this is good to go. As far as the readout from drupal-check, all of that seems to be code standard things un related to drupal 10 upgrade.

Given my manual testing, marking RTBC.

DamienMcKenna’s picture

Agreed on committing the changes as-is and working on additional fixes as separate issues, e.g. the getForm() method has been that way since at least 8.9: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21Fo...

O&#039;Briat’s picture

I'm concern about the "field_read_fields" function calls in the module file, there are Drupal 7 ones, should I open a separate issue about that ?

O&#039;Briat’s picture

upgrade_status shows no errors or warning, as for drupal-check, there are two issues about that (I miss them :( ) :
https://www.drupal.org/project/fivestar/issues/3224945 & https://www.drupal.org/project/fivestar/issues/3224943.

As my basic usages are working fine on Drupal 10 without throwing any errors, I think it cold be marked as RTBC

O&#039;Briat’s picture

@heddn Sorry, but most errors are more than just "code standard things": missing function, removed parameters, ... I regroup them in one issue/MR https://www.drupal.org/project/fivestar/issues/3377377. IMHO, until these issues are fixed, this module should remain as alpha or beta.

DamienMcKenna’s picture

@O'Briat: Nobody is disputing the stability status of the module, we're just focused on getting this change committed.

markus_cz’s picture

Hi, I'm trying to get my head around what I need to do to update to Drupal 10, and I'm a bit confused. I'd prefer waiting for a release, or even a dev-build with all the changes applied. However, judging by the commit log, no changes have been commited in a year. If I understand correctly, this hasn't been done yet because we're waiting for the module maintainer but they're not active?

wxman’s picture

@markus_cz I've been watching this too for the same reason. I have the whole site ready to upgrade to 10 except for FiveStar. If it's any help to you, Here are parts of my composer.json that I applied patches and MR's:

     "repositories": {
        "fivestar" : {
            "type": "package",
            "package": {
                "name": "drupal/fivestar",
                "type": "drupal-module",
                "version": "1.x-dev",
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3287600/",
                    "reference": "99e6a9bb1f6407a143d664bcb61e29d10b3de4af"
                },
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3309729/",
                    "reference": "c9dff23c0836d262052c5cf141adfd9dccab594b"
                },
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3309729/",
                    "reference": "b696efe72c91170095a9f90dbe271fbe12d8555f"
                },
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3324052/",
                    "reference": "51b40c765a37cf34140996e325f2551462d9857e"
                }
            }
        },
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "0": {
            "type": "vcs",
            "url": "https://github.com/mcaskill/composer-merge-plugin"
        }
    },
    
    
    "require": {
        "drupal/fivestar": "1.x-dev@dev",
    },

    "extra": {
        "patches": {
            "drupal/fivestar": {
                "Remove fivestar_preview theme function": "https://www.drupal.org/files/issues/2022-04-06/3273701_3.patch"
            }
        },
    }

So far everything is working great, and the errors have all gone. Upgrade Status still says it's not compatible though. It's my only one.

wxman’s picture

I am by no means a PHP expert. I understand some of it, and look up what I don't. Please fogive me if this sounds wrong.

Upgrade Status showed three errors. One was in web/modules/contrib/fivestar/tests/src/Functional/FivestarTest.php line 145:
$this->assertRaw('No votes yet', 'Fivestar field has no votes.');
The test says it need to be changed to:
$this->assertSession()->responseContains('No votes yet', 'Fivestar field has no votes.');

The other two were library's in web/modules/contrib/fivestar/fivestar.libraries.yml for the "Remove jQuery dependency from the once feature":

fivestar.base:
  version: VERSION
  css:
    component:
      css/fivestar.css: {}
  js:
    js/fivestar.js: {}

  dependencies:
    - core/jquery
    - core/drupal
    - core/jquery.once
    - core/drupal.ajax

fivestar.admin:
  version: VERSION
  css:
    component:
      css/fivestar-admin.css: {}

fivestar.ajax:
  version: VERSION
  js:
    js/fivestar.ajax.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/jquery.once

I read the post regarding that at https://www.drupal.org/node/3158256 and tried this change:

fivestar.base:
  version: VERSION
  css:
    component:
      css/fivestar.css: {}
  js:
    js/fivestar.js: {}

  dependencies:
    - core/drupal
    - core/once

fivestar.admin:
  version: VERSION
  css:
    component:
      css/fivestar-admin.css: {}

fivestar.ajax:
  version: VERSION
  js:
    js/fivestar.ajax.js: {}
  dependencies:
    - core/drupal
    - core/once

I saved, flushed caches, and checked all my pages with Fivestar. Everything worked perfectly and no errors. This goes along with the MR and patch I posted above that come from the people that really do know what they are doing. Upgrade Status still has two errors left on the web/modules/contrib/fivestar/fivestar.info.yml, and web/modules/contrib/fivestar/composer.json that complain about core_version_requirement and drupal/core requirement but that is just a simple fix. Is what I did wrong, because it seems to work?

ivnish’s picture

Same question as #51

TR, what is the final blocker of the module release with D10 compatibility? Can you explain?

ivnish’s picture

I reroll the patch to the latest dev

ivnish’s picture

Status: Reviewed & tested by the community » Needs review
heddn’s picture

re #72: what version of the code did you re-roll? There are several patches and even an open MR. What was the source of your changes so it is easy to review?

jonathan_hunt’s picture

fwiw, applying patch from #72 allows FiveStar to pass the Upgrade Status Drupal 10 readiness checks.

ivnish’s picture

heddn, I analyzed the patch #34 and the MR. I removed some already committed code so patch is applying to the latest dev version.

As said #75 the patch is successfully applied and passed the Upgrade Status Drupal 10 readiness checks.

Also I manually tested my project and I don't have any problem. Everything works and no any WSOD

wxman’s picture

I just installing the latest DEV but it's showing incompatible again. I did composer require 'drupal/fivestar:1.x-dev@dev'.

My composer.json still has:

     "repositories": {
        "fivestar" : {
            "type": "package",
            "package": {
                "name": "drupal/fivestar",
                "type": "drupal-module",
                "version": "1.x-dev",
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3287600/",
                    "reference": "99e6a9bb1f6407a143d664bcb61e29d10b3de4af"
                },
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3309729/",
                    "reference": "c9dff23c0836d262052c5cf141adfd9dccab594b"
                },
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3309729/",
                    "reference": "b696efe72c91170095a9f90dbe271fbe12d8555f"
                },
                "source": {
                    "type": "git",
                    "url": "https://git.drupalcode.org/issue/fivestar-3324052/",
                    "reference": "51b40c765a37cf34140996e325f2551462d9857e"
                }
            }
        },

The errors are in the web/modules/contrib/fivestar/fivestar.libraries.yml. It want's fivestar.base and fivestar.ajax removed.
The others are the simple ones in fivestar.info.yml core_version_requirement

jonathan_hunt’s picture

@wxman I simply ran composer require "drupal/fivestar:dev-1.x" with no specific references in composer.json. composer.patches.json:

    "drupal/fivestar": {
      "#3287600 Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2023-09-01/fivestar-3287600-72.patch"
    },
wxman’s picture

@jonathan_hunt I removed everything and added the patch you said. Reran require and all is well now. Thank you.

heddn’s picture

I've opened #3386131: Offer to co-maintain Fivestar to hopefully keep the ball rolling here.

ivnish’s picture

heddn, thanks!

wxman’s picture

Has something changed? I was getting ready to take the plunge to upgrade the site to 10 and even though I have things still set from #78 I'm now back five star not working and a page full of:

Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1525 of core/lib/Drupal/Core/Database/Connection.php).

Did I miss something?

ivnish’s picture

The patch #72 doesn't have "addcslashes" function. Try to find it in another modules

wxman’s picture

@ivnish I honestly don't know what's going on now. I have gone back to a backup copy from a couple of weeks ago, and the error is there on every page there is a FiveStar field. On the pages that it's not used the error doesn't show up. The only patch I'm using is the one shown in #78.

ayush9598 made their first commit to this issue’s fork.

heddn’s picture

Title: Automated Drupal 10 compatibility fixes » Drupal 10 compatibility fixes

Re-titling. The changes are not automated.

  • heddn committed f5485838 on 8.x-1.x authored by ivnish
    Issue #3287600 by dancbatista, heddn, ivnish, TR, heddn: Drupal 10...
heddn’s picture

Status: Needs review » Fixed

Given the latest comments in #3273701: Remove 'fivestar_preview' theme function, I'm leaving the dead code for an eventual conversion, or at least we can keep debating how we want to handle its conversion. I tested leaving the code in the code-base and nothing bad happens. It is dead code. Commented as such and committed. A tagged D10 release should come shortly.

Hopefully I got all the right people who were involved on this issue credited. It ended up that most of the work was done in sub-issues and this one really just changes the supported versions in composer.json and .info.yml.

heddn’s picture

wxman’s picture

Well I made the leap to D10. I installed the latest Fivestar Alpha4. The only error on the the site is Fivestar though. I'm still getting:

Deprecated function: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Database\Connection->escapeLike() (line 1525 of core/lib/Drupal/Core/Database/Connection.php).

I also noticed that the stars can no longer be selected, or edited, like I want to give a book a rating. I know it has to be connected to Fivestar because it only occurs on pages with that field on it.

I have no other patches installing. Is there a Fivestar patch I still need that I'm missing?

heddn’s picture

@wxman can you open a new issue w/ steps to reproduce? Then link it here? Ideally on a fresh/vanilla Drupal 10 install. I'm using this module on a D10 site for several months now and haven't not seen those specific errors in the logs.

wxman’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.