Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-65787

PHP 7.2 Warning: count(): Parameter must be an array or an object that implements Countable in badges/classes/form/collections.php

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.7
    • Fix Version/s: 3.7.1
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      Requirements

      1. PHP 7.2.
      2. An account set up on openbadges.org and for the user to have obtained at least one badge (eg http://www.openbadges.org/earn/) and for this badge to be added to a collection and made public (http://backpack.openbadges.org/). MDLQA-13265 explains how to prepare it. 
      3. 2 accounts set up on badgr.io. One of them should have at least one badge and for this badge to be added to a collection and made it public (https://badgr.io/). MDLQA-13510 explains how to prepare it. 
      4. mailcatcher (or similar or working mail) to intercept emails.
      5. It will not work on a localhost Moodle; it must be online to connect to openbadges.org (e.g. using ngrok).

      Setup

      1. As admin verify that badges are enabled in Administration / Site administration / Advanced features.
      2. Access to "Site administration / Badges / Backpack settings" and make sure the site backpack is set to "https://backpack.openbadges.org/".
      3. Under the user menu (at the upper right), select 'My preferences'.
      4. Click on "Backpack settings" under Badges.
      5. Add the email address for the backpack.openbadges.org account as the email address for the backpack connection.
      6. Click on 'Sign in with your Email.'
      7. Read the verification email and click on the link to verify the connection to the backpack.

      Testing scenario 1: Mozilla OpenBadges Backpack

      1. Access to "Site administration / Badges / Backpack settings".
      2. Verify some collection is displayed in the "Badge import settings" section.
      3. Verify each collection in the "Badge import settings" section has the correct number of badges in the parenthesis.
      4. Verify that no warning is displayed on the top of the page.

       

      Testing scenario 2: Badgr.io

      1. Go to "Site administration / Badges / Backpack settings" and set the site backpack to https://badgr.io.
      2. Go to "Site administration / Badges / Badges settings" and set the Badgr admin account email as badge issuer email address.
      3. Go to "Site administration / Badges / Manage backpacks", edit the settings for the badgr.io backpack and enter the Badgr admin account password as badge issuer password (the appropriate for the user account added in the previous step).
      4. Under the user menu (at the upper right), select 'My preferences'.
      5. Click on "Backpack settings" under Badges.
      6. Add the email address for the other badgr.io account as the email address for the backpack connection. Fill in also the correspondent password.
      7. Click on 'Sign in with your Email.'
      8. Read the verification email and click on the link to verify the connection to the backpack.
      9. Access to "Site administration / Badges / Backpack settings".
      10. Verify some collection is displayed in the "Badge import settings" section.
      11. Verify each collection in the "Badge import settings" section has the correct number of badges in the parenthesis.
      12. Verify that no warning is displayed on the top of the page.
      Show
      Requirements PHP 7.2. An account set up on openbadges.org and for the user to have obtained at least one badge (eg  http://www.openbadges.org/earn/ ) and for this badge to be added to a collection and made public ( http://backpack.openbadges.org/ ).  MDLQA-13265 explains how to prepare it.  2 accounts set up on badgr.io. One of them should have at least one badge and for this badge to be added to a collection and made it public ( https://badgr.io/ ).  MDLQA-13510  explains how to prepare it.  mailcatcher (or similar or working mail) to intercept emails. It will not work on a localhost Moodle; it must be online to connect to openbadges.org (e.g. using ngrok). Setup As admin verify that badges are enabled in Administration / Site administration / Advanced features. Access to "Site administration / Badges / Backpack settings" and make sure the site backpack is set to "https://backpack.openbadges.org/". Under the user menu (at the upper right), select 'My preferences'. Click on "Backpack settings" under Badges. Add the email address for the backpack.openbadges.org account as the email address for the backpack connection. Click on 'Sign in with your Email.' Read the verification email and click on the link to verify the connection to the backpack. Testing scenario 1: Mozilla OpenBadges Backpack Access to "Site administration / Badges / Backpack settings". Verify some collection is displayed in the "Badge import settings" section. Verify  each collection in the "Badge import settings" section has the correct number of badges in the parenthesis. Verify that no warning is displayed on the top of the page.   Testing scenario 2: Badgr.io Go to "Site administration / Badges / Backpack settings" and set the site backpack to https://badgr.io . Go to "Site administration / Badges / Badges settings" and set the Badgr admin account email as badge issuer email address. Go to "Site administration / Badges / Manage backpacks", edit the settings for the badgr.io backpack and enter the Badgr admin account password as badge issuer password (the appropriate for the user account added in the previous step). Under the user menu (at the upper right), select 'My preferences'. Click on "Backpack settings" under Badges. Add the email address for the other badgr.io account as the email address for the backpack connection. Fill in also the correspondent password. Click on 'Sign in with your Email.' Read the verification email and click on the link to verify the connection to the backpack. Access to "Site administration / Badges / Backpack settings". Verify some collection is displayed in the "Badge import settings" section. Verify  each collection in the "Badge import settings" section has the correct number of badges in the parenthesis. Verify that no warning is displayed on the top of the page.
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull 3.7 Branch:
    • Pull Master Branch:
      MDL-65787-master

      Description

      Steps to reproduce (using PHP 7.2):

      1. Access to the "Backpack settings".
      2. Connect to the OpenBadges backpack ("https://backpack.openbadges.org"), following the steps defined in MDL-65705.

      When the user has one or more public collections, the following error is displayed:

      Warning: count(): Parameter must be an array or an object that implements Countable in badges/classes/form/collections.php on line 95

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sarjona Sara Arjona (@sarjona)
                Reporter:
                sarjona Sara Arjona (@sarjona)
                Peer reviewer:
                Amaia Anabitarte
                Integrator:
                Jun Pataleta
                Tester:
                Anna Carissa Sadia
                Participants:
                Component watchers:
                Yuliya Bozhko, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Jul/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h