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

sqlsrv driver: Parameter must be an array or an object that implements Countable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.1, 3.5
    • Fix Version/s: 3.4.2
    • Component/s: Database SQL/XMLDB
    • Labels:
    • Testing Instructions:
      Hide
      • Requisites: With PHP 70, 71 and 72, and a SQL*Server database (surely you'll need to use the modole docker images, because I'm not aware of any other sqlsrv build working yet for php72). Specifically, for PHP72 you will need the one @ https://github.com/moodlehq/moodle-php-apache/issues/16 that discovered this issue. I'm afraid, it's not merged yet ).
      • init unit tests
        • VERIFY: No PHP Warning: count(): Parameter... is displayed along the execution.
        • VERIFY: The process ends ok and you can:
      • execute vendor/bin/phpunit lib/dml/tests/dml_test.php
        • VERIFY: The PHP version in the output matches the one being tested.
        • VERIFY: Also "sqlsrv" is shown.
        • VERIFY: No PHP Warning: count(): Parameter... is displayed along the execution.
        • VERIFY: The process ends ok without errors (skipped is ok).
      Show
      Requisites: With PHP 70, 71 and 72, and a SQL*Server database (surely you'll need to use the modole docker images, because I'm not aware of any other sqlsrv build working yet for php72). Specifically, for PHP72 you will need the one @ https://github.com/moodlehq/moodle-php-apache/issues/16 that discovered this issue. I'm afraid, it's not merged yet ). init unit tests VERIFY : No PHP Warning: count(): Parameter... is displayed along the execution. VERIFY : The process ends ok and you can: execute vendor/bin/phpunit lib/dml/tests/dml_test.php VERIFY : The PHP version in the output matches the one being tested. VERIFY : Also "sqlsrv" is shown. VERIFY : No PHP Warning: count(): Parameter... is displayed along the execution. VERIFY : The process ends ok without errors (skipped is ok).
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      When preparing Moodle for 7.2 (MDL-60279), we weren't able to test the sqlsrv driver yet (because it was not available).

      Some minutes ago I've been finally able to get sqlsrv working under php 7.2 as part of:

      https://github.com/moodlehq/moodle-php-apache/issues/16

      and immediately have start getting thousands of warnings:

      PHP Warning:  count(): Parameter must be an array or an object that implements Countable 
      in /var/www/html/lib/dml/sqlsrv_native_moodle_database.php on line 446
      

      We already faced similar cases, easy to fix, specially here because we can use null that is the default value instead of count(). In fact all other drivers are using null comparison since the beginning of the times.

      And that's all... proceeding... ciao

        Attachments

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Peer reviewer:
            Jun Pataleta
            Integrator:
            Andrew Nicols
            Tester:
            Andrew Nicols
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              19/Mar/18