Skip to content

fixed a rare case where assets urls are created invalid #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vannidellaricca
Copy link

@vannidellaricca vannidellaricca commented Mar 24, 2025

Hi,
we found an rare case in which library return an invalid url.
some preconditions:

  • php engine jail in chrooted mode ( or DocumentRoot is in root filesystem).
  • base root have the same name of domain
    which this condition in file Config.php on method get_url the function str_replace trigger the transformation many time for the string.
    this is te our test env

wp_list_pluck( $bases, 'base_dir' ) return

Array
(
    [wpmu_plugin] => /miodominiouno.it/ita/wp-content/mu-plugins
    [wp_plugin] => /miodominiouno.it/ita/wp-content/plugins
    [wp_content] => /miodominiouno.it/ita/wp-content
    [plugins] => /miodominiouno.it/ita/wp-content/plugins
    [stylesheet] => /miodominiouno.it/ita/wp-content/themes/twentytwentyfive
))

wp_list_pluck( $bases, 'base_url' ) return

Array
(
    [wpmu_plugin] => http://miodominiouno.it/ita/wp-content/mu-plugins
    [wp_plugin] => http://miodominiouno.it/ita/wp-content/plugins
    [wp_content] => http://miodominiouno.it/ita/wp-content
    [plugins] => http://miodominiouno.it/ita/wp-content/plugins
    [stylesheet] => http://miodominiouno.it/ita/wp-content/themes/twentytwentyfive
)

the transformation return
http:/http:/http://miodominiouno.it/ita/wp-content/plugins/the-events-calendar/common/

we have made a test using strtr that perform only one substitution and the code works.

We attach a 1 line patch

@dpanta94 dpanta94 self-requested a review March 24, 2025 12:10
@bordoni
Copy link
Member

bordoni commented Mar 31, 2025

@vannidellaricca thank you for this PR.

I would love to see us have a Test set for this @dpanta94 before we merge.

Not 100% a priority but worth the time after we finish Tyson.

@dpanta94 dpanta94 self-assigned this Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants