Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-14649

Issues with CRM_Utils_HttpClient::fetch()

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      The CRM_Utils_HttpClient::fetch() function does not return an error if the source URL does not exist (HTTP 404 error). This is because it is missing a curl option: curl_setopt($ch, CURLOPT_FAILONERROR, true );
      (cf. http://se2.php.net/manual/en/function.curl-error.php#87212)

      Also the error messages for the function are very specific to the extensions system, making this function unusable if say you want to use it to download say ... translations, or resources from other websites.

      Ideally it should return a generic status code that the caller will then translate in a specific error message. Such status codes could be:

      • CONFIGURATION_ERROR: the download cannot proceed due to a system configuration error (curl not activated, etc)
      • DOWNLOAD_ERROR: the file could not be downloaded (HTTP error, malformed URL, etc),
      • SAVE_ERROR: the file could not be saved (permissions, etc)
      • STATUS_OK: all is well

        Attachments

          Activity

            People

            • Assignee:
              timotten Tim Otten
              Reporter:
              nganivet Nicolas Ganivet
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 30 minutes
                30m
                Remaining:
                Remaining Estimate - 30 minutes
                30m
                Logged:
                Time Spent - Not Specified
                Not Specified