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

Deprecated some flags using FILTER_VALIDATE_URL

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6, 3.7
    • Fix Version/s: 3.6.3
    • Component/s: General
    • Labels:
    • Testing Instructions:
      Hide

      With all supported PHP versions (7.1, 7.2 and 7.3):

      1. Copy the attached verify_filter_var.php to the root dir of your Moodle installation.

      2. Run it via cli: php verify_filter_var.php

      3. Verify that you get an Ok! without any PHP warning or notice.

      Show
      With all supported PHP versions (7.1, 7.2 and 7.3): 1. Copy the attached verify_filter_var.php to the root dir of your Moodle installation. 2. Run it via cli: php verify_filter_var.php 3. Verify that you get an Ok! without any PHP warning or notice.
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      The explicit usage of the constants FILTER_FLAG_SCHEME_REQUIRED and
      FILTER_FLAG_HOST_REQUIRED is now deprecated; both are implied for
      FILTER_VALIDATE_URL anyway.

      We have 2 uses of this is core:

      lib/typo3/class.t3lib_div.php
      1530:		return (filter_var($IDN->encode($url), FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) !== FALSE);
       
      lib/phpmailer/src/PHPMailer.php
      3581:        if (filter_var('http://' . $host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
      

      Need to see if it's reachable code and get rid of the deprecated flags (since 5.2!) to avoid this added PHP Deprecated warning:

      PHP Deprecated:  filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in xxxx
      

        Attachments

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Peer reviewer:
            Mark Nelson
            Integrator:
            Jun Pataleta
            Tester:
            Anna Carissa Sadia
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

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

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 15 minutes
                15m