Live data from Hacker News

My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

jakeasmith.com

61–70 of 88 posts

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#62
post #22

Crazy that the bug went unnoticed. So many sites must have been broken by the "a" bug.

It only kicks in in the presence of a trailing / - perhaps this is rare where the function is commonly used.

Considering that every WordPress permalink has a trailing slash by default, and given that WordPress is sort of a big deal in PHP, I'm surprised that it took so long to find that bug.

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#63

Earlier quoted context omitted.

The JavaScript world is littered with stuff comparing to which your patch seems like a complex project. See those examples: https://www.npmjs.com/package/is-odd https://www.npmjs.com/package/is-even https://www.npmjs.com/package/left-pad https://www.npmjs.com/package/is-whitespace-character https://www.npmjs.com/package/isarray

what a broken ecosystem.. The crazy thing is not that the package exists, but that it is used by JS devs.

There’s not much evidence these are being used, only that they are dependencies for something else; that’s why the download numbers are so high.

I wouldn’t say it’s broken, I’d say there are tradeoffs, and devs have known this and discussed it since the start of npm or any package manager. You automatically get some bloat when you use other people’s software. That’s the downside. The upside is you don’t have to write the code yourself and you can create things more quickly by not solving problems that others have already solved.

It’s worth noting that AI has some of the same tradeoffs. The quality of what you get is still proportional to your prompting & reviewing effort, and spending low amounts of effort often results in similar amount of bloat.

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#64

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.

I have written A LOT of PHP in my life. Not so much anymore but I only have fond memories of the community - thanks to folks like you. Kudos.

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#67
> 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...)

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#68

> 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 codebas…

Heh, right?

Author: Ugh, this is ugly, but it fixes the specific problem I’m having so I can go on and work on other things.

Author, later: What do you mean, you’re all using this?

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#69
post #25

Are you from Nebraska?

I am, or was. Once, while living there, I wrote a little C program to read a Visual FoxPro database file and write out PostgreSQL commands to load the data. It was for my employer at the time. We needed it for a migration.

And then, a year later, I got invited to a PostgreSQL convention in Brazil where it was one of the tools being quasi-formally recommended to help migrate the country off of VFP.

The world can feel awfully freaking small sometimes.

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#70
post #17

Earlier quoted context omitted.

I feel like I have to remind people of this quite often, but the history is such that npm was lightweight at one point, bundling wasn't a thing, and while `isodd`/`iseven` are of course silly, things like `isarray` were not functions that existed back then (we didn't have Array.isArray). `typeof [] === 'object'` in JS, so e.g. my package `is-arrayish` checked for a similar structure to an array (whereas Id guess `isa…

I don’t think it ever made sense. Code reuse improves efficiency when the code can be shared in memory, or when it needs to be updated and you only have to change it in one place. JS packages don’t give you sharing beyond what you’d get from copying the code. And these little things don’t need to be updated, and in fact you probably don’t want them to be. It’s a case of doing something without understanding why it’s…

This is all very easy to say in hindsight. It's missing the context of having been there, I think. Things were just different.

Also, way more fun.

Post reply on HN