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

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.4.1, 3.5
    • 3.4.2
    • Database SQL/XMLDB
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_34_STABLE
    • 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).

    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

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Jun Pataleta Jun Pataleta
            Andrew Lyons Andrew Lyons
            Andrew Lyons Andrew Lyons
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              19/Mar/18