Moodle
  1. Moodle
  2. MDL-10384

Recipient names become always "Array" in message feature.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.8.9, 1.9.5
    • Component/s: Messages
    • Labels:
      None
    • Environment:
      Multi-bytes character-set environment.
    • Rank:
      28859

      Description

      function email_to_user() in lib/moodlelib.php

      for example, followings are header of received email.
      --------------------------
      (OK) To: ??? ??? <shirai.shirai@nifty.com>
      (NG) To: Array <shirai.shirai@nifty.com>
      --------------------------

      foreach ($mail->ReplyTo as $key => $rt) { //ReplyTo Names
      // $mail->ReplyTo[$key][1] = $textlib->convert($rt, 'utf-8', $mail->CharSet); : original
      $mail->ReplyTo[$key][1] = $textlib->convert($rt[1], 'utf-8', $mail->CharSet); : modified by shirai
      }
      $mail->Subject = $textlib->convert($mail->Subject, 'utf-8', $mail->CharSet); //Subject
      foreach ($mail->to as $key => $to) {
      // $mail->to[$key][1] = $textlib->convert($to, 'utf-8', $mail->CharSet); //To Names : original
      $mail->to[$key][1] = $textlib->convert($to[1], 'utf-8', $mail->CharSet); //To Names : modified by shirai
      }
      ------------------------------
      need to change convert($rt, ...) to convert($rt[1], ...) , convert($to, ...) to convert($to[1], ...).
      since $rt and $to are array. $to[0] is email address, $to[1] is full name of recipient

        Activity

        Hide
        Tatsuya Shirai added a comment -

        This mistake is very easy mistake.
        Please correct CVS.

        Show
        Tatsuya Shirai added a comment - This mistake is very easy mistake. Please correct CVS.
        Hide
        Dan Poltawski added a comment -

        Thanks for the fix! Sorry this took so long to get reviewed.

        Just tested this out and its clearly an issue - I will commit to CVS tomorrow (after the current test/QA freeze ends)

        Show
        Dan Poltawski added a comment - Thanks for the fix! Sorry this took so long to get reviewed. Just tested this out and its clearly an issue - I will commit to CVS tomorrow (after the current test/QA freeze ends)
        Hide
        Dan Poltawski added a comment -

        Many thanks, i've fixed this in CVS

        Show
        Dan Poltawski added a comment - Many thanks, i've fixed this in CVS
        Hide
        Petr Škoda added a comment -

        thanks

        Show
        Petr Škoda added a comment - thanks

          People

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

            Dates

            • Created:
              Updated:
              Resolved: