A 174-line PHP shim I wrote in 2014 as a temporary fix now has nearly 20 million installs. Today I'm deprecating it.
My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

In 2014, I wrote a 174-line PHP polyfill for http_build_url() as a stopgap during AOL's CMS upgrade. It was installed nearly 20 million times and still gets over 400,000 monthly installs, bundled in WPML, Debian, and Ubuntu. After discovering a bug that strips every 'a' from paths with trailing slashes, I'm deprecating it rather than handing it to a new maintainer, to avoid supply-chain risks. The README explains how to switch to The League's URI library or PHP 8.5's built-in URI API.
I wrote this code to ease a painful migration, for myself and anyone else going through the same one. Thank you to everyone who sent a pull request or offered to take it over, and to the people who kept filing issues long after I’d stopped reading them. It was a good run for a temporary fix.
- Sander_Marechal
There is nothing as permanent as a temporary fix that works.
- jakeasmith
Author here, happy to answer any questions. I never imagined a polyfill for http_build_url would gain so much traction. After 12 years, deprecating it feels like the right move, especially given the new options from the community and PHP itself.
- swiftcoder
> Under a comment that reads // Workaround for trailing slashes, my code tacks an “a” onto the path so there’s always a last segment to cut off, then cuts it off with a find-and-replace. When the path ends in a slash, that last segment is just the “a”, and the find-and-replace takes every other “a” in the path with it.
This is top-tier. left-pad levels of "we should just implement trivial functions in our own codebases"
(I do not mean that as a knock on the author - it solved his use case just fine. Everyone who took a dependency on it afterward though...)
- amhoab
We used to work together at AOL. Glad to see you on here; I hope you're doing great!
- zackmorris
PHP did extensions and PECL modules wrong, due to its roots as a web server language. With managed hosting, often PHP doesn't offer what we might think of as basic functionality, since the admin didn't install/enable it. So it makes sense that these little one-off packages exist to route around snafus.
It's still my favorite language though, since it comes closest to shell language but with C-style syntax (other than maybe Perl, which is a write-only language and hard to read, which unfortunately inspired Ruby to inherit some anti-patterns).
I often dream about writing a modern hacker language that combines the best of everything like functional programming, higher-order methods, const by default, parallelism, sync blocking rather than async nonblocking concurrency, etc. It would also undo the pass-by-reference footguns added by PHP 5+ and return to the pass-by-value copy-on-write style of arrays. That's why I really can't endorse attempts like Hack which just introduce a new standard with its own problems.
The insight being that LLMs work around the limitations of mainstream languages and frameworks, rather than challenging assumptions from first principles and building better foundations.
- laruss5
For a package with that kind of install base, is there a final release that prints the migration options in a deprecation notice? People will find it years from now through old Stack Overflow answers.
- AltruisticGapHN
Should the repo be archived?
I rarely see people use that feature yet tons of repos on Github are essentially dead.
- hk__2
> Along with the numbers, there were a handful of GitHub issues, including one where joining a path onto a URL with a trailing slash strips every letter “a” out of the path.