Problem/Motivation

When trying to edit a page on a Drupal 10 website with the CDN module installed, I received the following error:

Uncaught PHP Exception Error: "Call to undefined function file_url_transform_relative()" at /code/web/modules/contrib/cdn/cdn.module line 53

The file_url_transform_relative() function was deprecated and removed from Drupal 10:

https://www.drupal.org/node/2940031

Steps to reproduce

Attempt to add or edit content page.

Proposed resolution

Use a method from the file_url_generator service, as described in the issue linked above.

Issue fork cdn-3395772

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kfolsom created an issue. See original summary.

shiv_yadav’s picture

Assigned: Unassigned » shiv_yadav

shiv_yadav’s picture

Assigned: shiv_yadav » Unassigned
Status: Active » Needs review

Hello kfolsom, i have create MR.
please review & retest it.
Thanks.

kfolsom’s picture

Hi, @shiv_yadav,

I've tested your code change and it works as expected now. Thanks much.

Let me know if you need any more info on this.

Keith

lordzik’s picture

Status: Needs review » Reviewed & tested by the community

That patch worked for me too.

dburiak’s picture

The MR works for me. Added a patch with the changes above to simplify using with composer.

Status: Reviewed & tested by the community » Needs work
dburiak’s picture

StatusFileSize
new1.25 KB
dburiak’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: 3395772.patch, failed testing. View results

dburiak’s picture

Status: Needs work » Reviewed & tested by the community
wim leers’s picture

Improving the automated testing of this module by switching to GitLab CI in #3401760: Adopt GitLab CI: PHPStan compliance + test against 9.5/10.0/10.1/10.2/11.x + max PHP version. That will either prove or disprove the need for this change irrefutably 😊👍

wim leers’s picture

Title: Call to Deprecated Function 'file_url_transform_relative()' » [Drupal >=10] When Far Future is enabled and CKEditor 4 is installed: Call to Deprecated Function 'file_url_transform_relative()'
Issue tags: +Drupal 10 compatibility
wim leers’s picture

PHPStan is all green now! 🤩

Sorry everyone for the long delay on this. It's been a hectic year 🫣

wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.