https://api.drupal.org/api/drupal/core!modules!system!system.module/func...

Currently the function system_retrieve_file generates a variety of Drupal error messages that cannot be suppressed or otherwise modified. This function should probably be modified to return the error to the calling function, allowing that function to determine what happens on an error instead of making an assumption on how errors should be handled.

With the way this is currently developed, it makes using this function for batch imports or other automated systems difficult without clearing all Drupal messages after executing the function. Furthermore, there is no easy way to programmatically determine why this function fails (ie, 404, 403).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

InternetDevels’s picture

looks like simply...

Status: Needs review » Needs work

jamesdixon’s picture

Would it make sense to write these errors to the log using watchdog(), and returning FALSE so we are still getting the same expected return values?

nyirocsaba’s picture

Status: Needs work » Needs review
FileSize
1.7 KB
jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
Nitesh Sethia’s picture

Status: Needs work » Needs review
FileSize
1.35 KB

Rerolled the patch as per the latest Release.

Status: Needs review » Needs work

The last submitted patch, 7: change-2177545-7.patch, failed testing.

hitesh-jain’s picture

Assigned: Unassigned » hitesh-jain

Status: Needs work » Needs review

hitesh-jain queued 7: change-2177545-7.patch for re-testing.

hitesh-jain’s picture

Assigned: hitesh-jain » Unassigned

I could apply the patch, so no reroll is needed.Thanks

Status: Needs review » Needs work

The last submitted patch, 7: change-2177545-7.patch, failed testing.

neetu morwani’s picture

Assigned: Unassigned » neetu morwani

Status: Needs work » Needs review
neetu morwani’s picture

Assigned: neetu morwani » Unassigned
RavindraSingh’s picture

The documentation is also required to be updated if this issue gets committed

https://api.drupal.org/api/drupal/core!modules!system!system.module/func...

RavindraSingh’s picture

Issue tags: -Needs reroll +Needs tests
RavindraSingh’s picture

Status: Needs review » Needs work

The last submitted patch, 7: change-2177545-7.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

robpowell’s picture

I am wondering if it is better to pass the responsibility of catching these exceptions to the implementer and not within the function. As said in the summary of this ticket, currently it uses messenger service which cannot be overriden. Similarly, if you update this to logger, \Drupal::service('logger_factory')->get('foo bar')->error('error message here'), you will have the same issue. I stumbled upon this will running a custom drush command, each run either via messenger/logger I would get the error in the command line. There's nothing to catch in my custom code.

If we pass control to the implementer, ie us, we can catch the result and create workflows we want. There's only two implementations in core so we don't have much risk there but I would like to get some feedback from the community.

Berdir’s picture

> There's only two implementations in core so we don't have much risk there but I would like to get some feedback from the community.

.. There are also usages in contrib and custom code.

Instead of changing the existing function, similar to how we updated the file_* functions in file.inc, we should move this to a service so it's easier to test and as part of that, change it to (re-)throw exceptions.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

kim.pepper’s picture

Status: Needs work » Closed (outdated)

I think this can be closed (outdated) as we have deprecated system_retrieve_file in #3223205: deprecate system_retrieve_file() without replacement