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

Array to string conversion in textlib.class.php

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3.1
    • Component/s: Blocks
    • Labels:
    • Testing Instructions:
      Hide

      1/ go to admin manage blocks page
      2/ no notices expected, the block should be sorted by names
      3/ repeat with non-english language with some special first chars in block names (such as Czech)

      Show
      1/ go to admin manage blocks page 2/ no notices expected, the block should be sorted by names 3/ repeat with non-english language with some special first chars in block names (such as Czech)
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w27_MDL-34115_m24_arrayofarrayssort

      Description

      When accessing moodle2/admin/blocks.php I received approximately 375 instances of the following notice, after which the page appears to load as expected:

      Notice: Array to string conversion in lib/textlib.class.php on line 785

      1. Time Memory Function Location
        1 0.0007 174440 {main}

        ( ) ../blocks.php:0
        2 1.3495 29669772 collatorlib::asort( ) ../blocks.php:228
        3 1.3496 29669912 Collator->asort( ) ../textlib.class.php:785

      I believe this may be because I am running Moodle 2.3 on PHP 5.4. Full specs:

      • Debian GNU/Linux unstable (sid)
      • Apache 2.2.22
      • MySQL 5.5.24
      • PHP PHP 5.4.4-2

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            skodak Petr Skoda added a comment -

            wow, it tries to sort arrays of arrays, we need to use $sortflag REGULAR because our asort now defaults STRING comparison

            Show
            skodak Petr Skoda added a comment - wow, it tries to sort arrays of arrays, we need to use $sortflag REGULAR because our asort now defaults STRING comparison
            Hide
            skodak Petr Skoda added a comment -

            SORT_REGULAR is not locale aware, I had to rewrite the sorting a bit more, there do not seem to be other places affected by this.

            thanks a lot for the report!

            Show
            skodak Petr Skoda added a comment - SORT_REGULAR is not locale aware, I had to rewrite the sorting a bit more, there do not seem to be other places affected by this. thanks a lot for the report!
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Petr, this has been integrated now

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Petr, this has been integrated now
            Hide
            abgreeve Adrian Greeve added a comment -

            Tested in the following languages:

            • English
            • Czech
            • Japanese
            • Chinese mandarin (Taiwanese)
              All seemed to be in alphabetical order and I encountered no problems.
            Show
            abgreeve Adrian Greeve added a comment - Tested in the following languages: English Czech Japanese Chinese mandarin (Taiwanese) All seemed to be in alphabetical order and I encountered no problems.
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Congratulations your code is upstream - gold star for you!

            This issue + 79 others made it in in time for the minor releases.
            Thank you everyone involved for your exuberant efforts.

            Show
            samhemelryk Sam Hemelryk added a comment - Congratulations your code is upstream - gold star for you! This issue + 79 others made it in in time for the minor releases. Thank you everyone involved for your exuberant efforts.

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jul/12