The php_url helper function is broken


3 years ago
3 years ago


(Reporter: malexis, Unassigned, Mentored)




Firefox Tracking Flags

(Not tracked)


(Whiteboard: [kb=1700343] [good first bug])



3 years ago is a 404. Need to remove the link from the body text on this page (under the 4th question):


3 years ago
Whiteboard: [good first bug] → [kb=1700343] [good first bug]

Comment 2

3 years ago
(In reply to Jennifer Bertsch [:jbertsch] from comment #1)
> works.

OK edited summary to edit the link instead of remove.
Summary: Remove MPL hyperlink from /foundation/trademarks/faq → Add trailing slash to MPL hyperlink on /foundation/trademarks/faq
Hello, I would like to work on this bug, though am unsure where I would go to begin editing the link. I am new to this, sorry if this seems like to basic of a question.
Hi Wickie, welcome to! The relevant code is here:

But... looks like this link itself is correct. The issue is probably that the php_url function is not working as expected for some reason; it should not add the en-US (or any other locale) prefix to the link:

Do you have a Python experience? The detailed document can be found at:
Component: Pages & Content → Bedrock
Keywords: regression
OS: Mac OS X → All
Hardware: x86 → All
Summary: Add trailing slash to MPL hyperlink on /foundation/trademarks/faq → The php_url helper function is broken
Version: Development/Staging → Production
Alright, so I am probably going to say something stupid now. Is it wrong for me to explicitly make php_url skip joining the locale if the url is /MPL?
For now only /MPL is obviously broken, but looks like we have a similar issue for /thunderbird/. The /thunderbird/ page has a locale prefix, but if we append a locale prefix to the /thunderbird/ link, it will be broken in some locales (as reported in Bug 1033930.)

So, I think the quick solution here is making php_url simply return the passed url, not only for /MPL but for all links, without appending any locale prefix.
Or we could just avoid using the function and instead use a static link in HTML.
I would upload my patch. But I do not have the required permissions yet. So I need to be assigned to this bug first, if anyone can do that. Also, wouldn't returning it without the locale mess up other calls made to that function? I was just going to leave it as is, except when the url is "/MPL" return url as is
Sorry I'm late here! I have cleaned up legacy php_url usage in

So now we only have /MPL/ and /thunderbird/

I think we can simply
* remove the php_url function from, and
* update the HTML templates to use static links
** <a href="{{ php_url('/thunderbird/') }}"> → <a href="/thunderbird/">
** mpl=php_url('/MPL') → mpl='/MPL/'
instead of fixing the function.

Wickie: do you want to send a pull request for that?
Flags: needinfo?(wickie.leejr)

Comment 10

3 years ago

First time here. Is there anything left to do for this bug? I would love to contribute!
@wickie are you still working on this?
@Kohei Apologies! I have been extremely busy lately, I would like to still work on it, however am unfamiliar with making pull requests, and am going to be going out of town in a couple of days. I am not sure I will have time for it in the days I have before I go, so Deepak can have it if he is still interested.
Flags: needinfo?(wickie.leejr)

Comment 13

3 years ago
@Kohei I am new here. To fix the bug should I fork the repo, make changes and then send pull request?

Comment 14

3 years ago
@Kohei how can I get started with this bug?

Comment 15

3 years ago
Commits pushed to master at
[fix bug 1146683] Remove php_url helper function.
Merge pull request #3050 from ishanroy/master

Fix Bug 1146683 - The php_url helper function is broken


3 years ago
Last Resolved: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.